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
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.