This is a migrated thread and some comments may be shown as answers.

Validate for duplicate field value on create/update action

1 Answer 546 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Olivier
Top achievements
Rank 1
Olivier asked on 20 Nov 2020, 12:22 AM

Hello,

Sorry if this has already been asked, but I couldnt find a topic on that subject.

I would like to know if it's possible to validate for a duplicate value for a field when submitting an add/edit of a record in a grid (popup edit) and return an error in the form to inform the user that the value is already used.

I am able to do it in the appropriate handle after the submit but i can't seem to prevent the form to close and to display an error message to the user.

Thanks!

1 Answer, 1 is accepted

Sort by
0
Accepted
Nadezhda Tacheva
Telerik team
answered on 24 Nov 2020, 06:02 PM

Hello Olivier,

In order to prevent the form from closing you need to modify the IsCancelled property of the event arguments in the update/edit handler. Setting its value to false will keep the grid in Insert/Edit mode and the PopUp will remain opened. This way you will also be able to display the necessary error message.

More information as well as a relevant example you can find in this article - https://docs.telerik.com/blazor-ui/components/grid/editing/overview and this sample project - https://github.com/telerik/blazor-ui/tree/master/grid/remote-validation

Regards,
Nadezhda
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

Tags
Grid
Asked by
Olivier
Top achievements
Rank 1
Answers by
Nadezhda Tacheva
Telerik team
Share this question
or