Find the Row index when you click a button in a gridview by using the following in the button click method in code behind
GridViewRow row = ((LinkButton)sender).Parent.Parent as GridViewRow;
Response.Write(row.RowIndex);
Other way to use it is to have a command Name(for ex:View) and a Command Argument for the button and then using the GridView_RowCommand(object sender, GridViewCommandEventArgs e) _
There you can use some thing like
if (e.CommandName.ToString().Equals("View"))
{
int currentRowIndex = Int32.Parse(e.CommandArgument.ToString());
}
Showing posts with label command Argument. Show all posts
Showing posts with label command Argument. Show all posts
Monday, May 24, 2010
Subscribe to:
Comments (Atom)