Gridview rowupdating e cancel

In my web page, I've got a Grid View control that is data bound to an Object Data Source. In the event handler for on Updating, the event args object has a cancel property. But to keep gridview in update mode, you must mantain its edit index property, because when gridview is not in edit mode usually its edit index is set to -ve value, but if it is in edit mode, gridview edit index is set to some positive integer value. When this happens, I would like the row that was being updated to remain in the edit mode. One way to solve this problem is that you use Validation controls, which will restrict the user to send request if validation does not passes.The events are as described below: Row Updating - Occurs when a row's Update button is clicked, but before the Grid View control updates the row.Row Deleting – Occurs when a row's Delete button is clicked, but before the Grid View control deletes the row.

I have tried to add an event handler to the Row Updated event of my custom control but it is not called.

Here’s the code to cancel update and delete in a Grid View: Suprotim Agarwal, ASP.

NET Architecture MVP (Microsoft Most Valuable Professional) works as an Architect Consultant and provides consultancy on how to design and develop Web applications.

In data driven web sites, users are normally allowed to view data and administrators are allowed to add, edit or delete data.

In this tutorial I will show you how you can create an editable Grid View control for administrators to modify database records directly into the Grid View control.