When you are using paging then you use lines of code for finding the rowindex id
GridViewRow gvr = (GridViewRow)((LinkButton)e.CommandSource).NamingContainer;
int RowIndex = gvr.RowIndex;
When you are doesn't use paging then you ues below code to find the row index record
int index = Convert.ToInt32(e.CommandArgument);
// Retrieve the row that contains the button clicked
// by the user from the Rows collection. Use the
// CommandSource property to access the GridView control.
GridView customersGridView = (GridView)e.CommandSource;
GridViewRow row = customersGridView.Rows[index];
// Create a new ListItem object for the customer in the row.
Response.Write(Server.HtmlDecode(row.Cells[1].Text));
No comments:
Post a Comment