Using rowupdating event gridview
Naming Container as Grid View Row; now use this row.
You can not attach validation controls directly to these Text Boxes.This article will give you an overview of how to use an asp: Grid View completely, and how to use Row Editing, Row Updating, Row Deleting, Row Command, Row Data Bound, Row Canceling Edit, and Pagination in a Data Grid.From this article, you will have a clear view of the Grid View data insert, delete, and update operations.You can see the C# code below will give the row number whatever you are editing by New Edit Index property.So Grid View will put the appropriate row into the Edit Mode by assigning row number to its Edit Index property. You can follow any responses to this entry through the RSS 2.0 feed.The above piece of code will also do the same as label in Item Template and Textbox in the Edit Item Template.
By default all the boundfields will be trasferred as Textboxes in Edit Mode.
So am calling the method Bind Grid Data method which is overloaded .
I currently have a gridview populated by a datatable in viewstate. I will show you the code below, but what happens when I click edit is the textbox in cell 2 becomes empty, but the text in cell 1 doesn't. New Row(); 'Store the Data Table in View State View State("Current Table") = dt Grid View2.
May be you may think why am I using link buttons as we are provided with some command field buttons by Grid View.
Secondly if you want to include a custom field (some button or link) in the same column it’s not possible.
However, most of the real world cases call for validating the data being edited or deleted. Open its smart tag and choose “Configure Data Source” option to start Configure Data Source wizard.