This is a migrated thread and some comments may be shown as answers.
Intercepting the Update action of the Editor
3 Answers 13 Views
This is a migrated thread and some comments may be shown as answers.
Reid
Top achievements
Rank 2
Reid asked on 07 Apr 2018, 11:21 PM

I am trying to plan a way to negate the update process if the value the user has entered on a new record would be a duplicate.

This is in a custom editor on a popup so I could have an Ajax action when the user exits and/or changes the field value but I am not sure how to check if it is in edit or insert mode inside the custom editor.

Is there a suggested pattern to use here for this?

Thanks

3 Answers, 1 is accepted

Sort by
0
Viktor Tachev
Telerik team
answered on 12 Apr 2018, 07:13 AM
Hi Reid,

In order to implement the behavior I would suggest checking if the record exists in the Create Action for the Grid. If there is such item in the database do not send it for update and set the ModelState as invalid. Furthermore, you can specify a relevant error message. Then, handle the DataSource error event to intercept the error and alert the user.

Check out the example below that illustrates how you can use the error event. 


Give the approach a try and let me know how it works for you.

Regards,
Viktor Tachev
Progress Telerik
Try our brand new, jQuery-free Angular components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
0
Reid
Top achievements
Rank 2
answered on 17 Apr 2018, 09:50 AM

Hello Viktor,

Thank you for the reply.  I am trying to solve something else right now with the grids not showing data at all (I have a post above) and once that is solved I can return to this issue.

0
Viktor Tachev
Telerik team
answered on 19 Apr 2018, 11:08 AM
Hello Reid,

Please take your time to test the approach and how it works on your end. If you have additional queries do not hesitate to contact us again.


Regards,
Viktor Tachev
Progress Telerik
Try our brand new, jQuery-free Angular components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Tags
Grid
Asked by
Reid
Top achievements
Rank 2
Answers by
Viktor Tachev
Telerik team
Reid
Top achievements
Rank 2
Share this question
or