To get the selected row's ID and the value of the selected cell of a GridView in ASP.NET, we can use the SelectedRow.Cells that returns a collection of all cells of the selected row.
The index of collection starts with 0. That means, if you want the first cell, you must have to get the cell at the 0th position, something like this.
Gridview1.SelectedRow.Cells[0] ;
The following code gets the value of the second cell of the currently selected row in a GridView.
string grdid = Int32.Parse(Gridview1.SelectedRow.Cells[1].Text.ToString());