Getting the GridViewRow from checkbox checked event.

Get the GridView Row when a checkbox clicked from a GridView.

Here I’m going to give a sample code for getting the selected GridView Row from a Gridview when a checkbox clicked from that gridview.

protected void chkSelect_CheckedChanged(object sender, EventArgs e)


CheckBox selectChkBox = (CheckBox)sender;

GridViewRow row = (GridViewRow)( selectChkBox.Parent.Parent);

int index = row.RowIndex;


Here the “index” is the row of GridView.


No comments: