I have a DataTable that is bound to a DataGrid. A CheckBox is created in a data row. When I check the checkbox the code behind is hit, but I don't know how to get at the DataRow.
<asp:DataGrid ID="dgCaseStatusTypes"
runat="server"
AutoGenerateColumns="False"
CellPadding="5"
DataKeyField="InmateCaseStatusID"
OnItemCommand="dgCaseStatusTypes_ItemCommand">
<Columns>
<asp:BoundColumn DataField="Code" HeaderText="Code"></asp:BoundColumn>
<asp:BoundColumn DataField="Text" HeaderText="Text"></asp:BoundColumn>
<asp:TemplateColumn HeaderText="Prebook Visible" >
<ItemTemplate>
<asp:CheckBox id="chkBox1"
runat="server"
AutoPostBack="true"
checked= '<%# Eval("IsPreBookVisibleBool") %>'
OnCheckedChanged="OnCheckedChanged_Event"
></asp:CheckBox>
</ItemTemplate>
</asp:TemplateColumn>
</Columns>
</asp:DataGrid>
protected void OnCheckedChanged_Event(object sender, System.EventArgs e)
{
CheckBox cb = sender as CheckBox;
//how to get the DataRow that created this control?
}