Row Updating event, doesn’t work as all samples say it should do.All samples of course assume you’re doing everything in your page, but I have to do everything in my code-behind, because on forehand I don’t know what I’ll be binding to my Grid View.In this article we will look at how to update or delete a record in a database table using a Grid View control.

rowupdating textbox value-88

The problem is, I’d very much like to do so, if ASP. But I can’t set a Data Source property or anything on the Sql Data Source!!! I probably have to read the cells on the Grid View of the selected row, find the controls, get the values from those and insert those into my Data Set.

Which means I won’t make my 70% code reduction Microsoft has always promised me.

When a Grid View row is in edit mode then we can update the row's record in the relational database table.

So we need to create a Stored Procedure on which we pass all parameters that are updateable along with the primary key value, in other words the row data's key value that is being updated.

To do that we need a Row Editing event of the Grid View.

The Edit Index property of a Grid View determines the index of a row in edit mode. Update record and get updated state of the Grid View.

So what you need to do is store the data source (maybe in Session) and only bind rebind the data when you absolutely need to (Like during the Is Not Post Back) Do you understand?

Please post the code for your Page_Load method and the that handles your Update (your C# code) so we can have a better look at what's going on. Please give some references and/or details of how to. This wipes out the data provided by the user during editing (editing happens after the page load).

Delete a Record We can delete a record from the database table by clicking on the delete button that is in the Delete column of the Grid View.

We first of all create a Stored Procedure that gets the Id of an employee as a parameter from the Grid View on whichever row the user clicked. In this event, first we get the datakey value that is the id of an employee of whichever row the user clicked and that id is passed as a parameter to the Stored Procedure. According to the above, in these three operations we use three events of the Grid View for each operation.

But as I noted in the comments in that method, some collections that should contain the columns (names, old values and new values) are always empty. And the Row Updated method is never even touched!!! NET Forums that I need to use a Data Source control.