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

Conditional RadGrid update

1 Answer 119 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Martyna
Top achievements
Rank 1
Martyna asked on 18 Aug 2011, 09:14 AM
Hi,

I have relatively simple scenerio where I have to check some conditions before updating data. To manage data I'm using RadGrid with autoupdate. I would like to check some conditions before update (i.e. if the name already exists, if an issue date is greater then other max issue date in database etc.). What is the best practice to make such check and how to stop update if some conditions are not met?
I thought about SqlDataSource updating event but I don't know how to read values from controls in edit form of RadGrid. Maybe other event is much more efficient in this case. I appreciate your support in this case as well as snippet of example code is welcome.

Best Regards,

Darek

1 Answer, 1 is accepted

Sort by
0
Iana Tsolova
Telerik team
answered on 22 Aug 2011, 03:31 AM
Hi Martyna,

You can handle the ItemCommand/UpdateCommand event of the grid for your purpose. There you can extract the values entered by the user and see if they fulfil your requirements. If not, cancel the command by adding e.Canceled = true;

Regards,
Iana
the Telerik team

Thank you for being the most amazing .NET community! Your unfailing support is what helps us charge forward! We'd appreciate your vote for Telerik in this year's DevProConnections Awards. We are competing in mind-blowing 20 categories and every vote counts! VOTE for Telerik NOW >>

Tags
Grid
Asked by
Martyna
Top achievements
Rank 1
Answers by
Iana Tsolova
Telerik team
Share this question
or