Gridview rowupdating method

Next event is the Grid View Row Editing event to give ASP. You need to set the Edit Index property of the Grid View with the New Edit Index property of the Grid View Edit Event Args class.

If user clicks the Cancel button while Grid View is in editing mode, you need to Cancel the Editing process and also need to reset the Edit Index property to -1 in the Row Canceling Edit event of the Grid View control as shown below: The last step is to handle the Row Updating event to actually update the back end database.

Grid View Edit Event Args object knows the current row index so getting row index of the selected row in gridveiw is not big deal; just e. Value); Find the controls in the selected row by using Find Control method of gridviews rows collection and collect data from the text boxes. Check for Comman Name and invoke delete method for the selected row.

Uncheck Auto-Generate Field from the Property window.Set the Binding Field name to the Text Property of both controls for each template field to the respective Database Column Name i.e Eval(“Emp Name”).Set the Data Key Names property of Grid View to Primary Key Column of Data Base i.e. This property binds the database column field value to each row of gridview as a Unique Identifier.The Command Name property can contain any string name which can be used to recognize the type of command invoked from gridview. Create a Method to Bind the Grid View to Data Source named Bind Grid. Edit in Grid View For Editing Register Row Editing event of Grid View.Because when any of the event generated in Grid Veiw it fires Row Command Event. This method fetches data from the Get Employees method which returns Data Set from Employees table. To switch the normal mode to Edit mode of gridview Edit Index property plays important role.

Leave a Reply