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.Each column represents a field, while each row represents a record.The Grid View control supports the following features:use Row Editing, Row Updating, Row Deleting, Row Command, Row Data Bound, Row Canceling Edit, and Pagination in a Data Grid.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.
NET Grid View markup and associated code lets first enumerate the important code pieces of this tutorial. 首先在初始化Gridview时候定义主键的数组。 Grid View Teacher Student. 在进行删除操作，或者对某行进行操作获得列中的值。 string student Id = Grid View Teacher Student. Trim(); 3.如果只有单个的键值时候。如只有”Student Id“一个主键下面直接获得。 string student Id = Grid View Teacher Student. Introduction The Grid View control displays the values of a data source in a table.Last line of the following code is calling a local method for updating the database and passing all the parameters to this method.