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.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.
Font-Names="Verdana" Font-Size="10" Data Key Names="Product ID" Auto Generate Columns="false" onrowcancelingedit="Grid View1_Row Canceling Edit" onrowediting="Grid View1_Row Editing" onrowupdating="Grid View1_Row Updating"In the above code, I set two properties Show Edit Button and Show Cancel Button of Command Field.
Check out what I’m trying to do, maybe you can help?
First, I load up some data: After that, I’m doing some work to make my Grid View look beautifull, adding all columns by hand.
Now we access this connection string on the page so we can open a connection with the relation database. The first one accesses the connection string and the other is for the SQL connection.
Now we define a method for opening a connection with the relation database and returns a SQL connection object depending on the connection string that is passed as a parameter of the Sql Connection class constructor.