Search code examples
asp.netdatagridcheckboxrowoncheckedchanged

What row index has a template checkbox in a datagrid?


I have a datagrid and there is a checkbox which is template in each row. Suppose I am in CheckedChanged event of one of the checkboxes. Is there any way I can tell in which row of the datagrid that check box is in?


Solution

  • Ok I found a neat solution :) In the checkedChanged event I just wrote the following:

    ((GridViewRow)((Control)sender).Parent.Parent).DataItemIndex;