Once you set these properties you will find that the column headers of all the columns for which you specified Sort Expression property appear as clickable link buttons.Clicking on the link buttons raise two events: Just like paging events these events follow pre and post pattern. A datakey represents the primary key field or field of a record that can uniquely identify it in a data-bound control. Row Index represents the index of the particular row.
Edit Index property of Grid View is used to set index of the row to edit and Bind Grid View method is called to bind Grid View with the editing row.
Then Title Id of editing row is retrieved from the Grid View and passed to Bind Details View method to show Author’s detail in the Details View Mode Changing event of Details View control is fires before its mode is changed. New Mode is passed to Change Mode method of Details View to change its mode from Read Only to Edit.
Here in Grid View, in the beginning the major part is to make the decision of putting either a bound field or a template field and the answer is simple: When we want to place any control inside the Grid View then we can go for template field, otherwise bound field will be simpler.
I hope the above information was a little bit helpful for you, kindly let me know your valuable feedback or thoughts.
I am only going to show the different ways we can use code to take the value from Grid View.
First, we have to very be clear in our mind that there are mainly two ways of taking the cell value from the Grid View: This code is for taking the value apart from the Grid View events; that is, any common event using a sender object.
In this example, I am going to retrieve values from categories table of Northwind database. Drag a Grid View into the Web Form and assign Data Key Names property with the primary key column i.e. In the gdview_Row Editing and gdview_Row Deleting event, we have used the below code to retrieve categoryid from datakey of Grid View, int catid = int.
In one of my previous article I explained how to Master-Detail form using Grid View and Details View in ASP. In this ariticle I will explain how to edit a master/detail form in ASP.
NET from code behind Row Editing event fires when Edit button of a Grid View row is clicked.