Unplanned
Last Updated: 13 Nov 2026 09:06 by ADMIN
TacoWombat
Created on: 21 Jul 2022 09:25
Category: Grid
Type: Feature Request
17
Incell & Inline Editing must work with ValidationResult for custom validation attributes

When I override the IsValid method to return a ValidationResult the Incell & Inline edit modes allow the editing to be continued even if an invalid value is present. 

===

Telerik edit: A possible workaround is to cancel OnUpdate and possibly, OnEdit too. Here is a complete example:

https://blazorrepl.telerik.com/QyaWxkvv10stL8jB06

 

3 comments
ADMIN
Ivan Danchev
Posted on: 13 Nov 2026 09:06

Hello Leland,

We have the following KB article: https://www.telerik.com/blazor-ui/documentation/knowledge-base/validation-custom-dataannotations-validator 
In it we show how to return ValidationResult and include the failing field name(s) as a second argument of type IEnumerable<string>.

In the KB example, if you leave Shipping Address blank and attempt to submit, validation will work out and stop the submission, however, the error will appear only in the summary. An inline error message does not appear for Shipping Address. 

This is due to this line:

return new ValidationResult(FormatErrorMessage(validationContext.DisplayName), new List<string> { validationContext.DisplayName });

If we change it to:

return new ValidationResult(
    FormatErrorMessage(validationContext.DisplayName),
    new[] { validationContext.MemberName! });

the validation error now shows up inline for Shipping Address. Here's an updated example that includes the necessary change mentioned above: https://blazorrepl.telerik.com/cqvblnkX05cvZuLg33 

I will update the KB article accordingly. 

Regards,
Ivan Danchev
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

Leland
Posted on: 07 Nov 2026 04:46
I revisited this with Telerik UI for Blazor 15.1.0 and found that the behavior depends on whether the custom `ValidationAttribute` identifies the affected field.

This result allowed an invalid value to be committed in in-cell editing:

```csharp
return new ValidationResult(ErrorMessage);
```

This result correctly blocked the commit:

```csharp
return new ValidationResult(
    ErrorMessage,
    [validationContext.MemberName!]);
```

Microsoft documents that model validation associates results with fields using the reported member name:

https://learn.microsoft.com/en-us/aspnet/core/blazor/forms/validation#custom-validation-attributes

I also confirmed that the member-name version fixes the related inline-editing behavior from my forum thread: the tooltip and `k-invalid` styling remain after an invalid submission.

It appears that the original reproduction may be missing the member name rather than exposing a Telerik Grid defect. You may want to update the example/workaround or reconsider whether this feature request remains applicable.
Leland
Posted on: 28 Aug 2024 13:57
In addition to allowing the user to move to the next cell without correcting the invalid input, the k-invalid styling is replaced with k-valid styling if the user attempts to submit the record creation / update.  See this forum post for more details.