Gridview onrowupdating onrowupdated
In my custom grid View control I cannot raise the Row Updated event.I have tried to add an event handler to the Row Updated event of my custom control but it is not called.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.These properties will automatically render Edit, Update and Cancel buttons inside Grid View column.
Well, if you’ve got a Grid View, you may want to have programmatic decision making logic in place based on an update event happening.
I've spent the last day trying to figure it out, I have other Grid Views set up the same way in the site and they worked fine without the Data Key Names being specified but I'm guessing it's related to the table used here having no primary key.
I spoke a bit too soon, do you have any idea why only the old values are displayed in the Grid View Update Event Args?
Editing the Grid View control can be an incredibly easy feature to add for certain database tables, especially those who have no foreign key associated and can easily be edited through the use of a standard Text Box web control as shown in the figure below: 1.
You need to include the Grid View Command Field column to add Edit, Update and Cancel Buttons in the Grid View. You need to include Template Field for every column you want to provide Editing because Template Field provides you both Item Template and Edit Item Template to create interface for two separate Grid View modes. You need to handle Grid View events such as Row Editing, Row Canceling Edit and Row Updating to provide desired editing functionality.
Now I will show you the C# code behind file of the above ASP.