My code
<asp:GridView ID="FireFighters" runat="server" AutoGenerateColumns="false" OnRowDataBound="FireFighters_RowDataBound" >
<Columns>
<asp:BoundField HeaderText="שם הכבאי" DataField="username" />
<asp:CheckBoxField HeaderText="מצוות לאירוע" DataField="IsLinked" />
</Columns>
</asp:GridView>
I can't add and id to the asp:CheckBoxField, i tried calling it like this from code-behind:
foreach(GridViewRow gvr in FireFighters.Rows)
{
lst.Add(new FireFighter{username=gvr.Attributes["id"].ToString(),IsLinked=((gvr.Cells[1] as Control) as CheckBox).Checked});
}
But its null, how can i get the value(checked or not) of the Checkbox?