M
ma
Hello,
I have a GrideView that has 4 col. 3 of them are bound to a dataset and
the last one is not. The last one is check box. The check box is defined as
follow:
<asp:TemplateField HeaderText="Select">
<ItemTemplate>
<asp:CheckBox ID="chkSelect" runat="server" />
</ItemTemplate>
</asp:TemplateField>
I am trying to read the state of these checkbox using the folllwng code:
// Select the checkboxes from the GridView control
for (int i = 0; i < GridView_Enterprise_name.Rows.Count; i++)
{
GridViewRow row = GridView_Enterprise_name.Rows;
bool isChecked =
((CheckBox)row.FindControl("chkSelect")).Checked;
if (isChecked)
{
// do something
}
}
but the code doesn't work as isChecked is always false. What is the problem
and how can I solve it?
Regards
I have a GrideView that has 4 col. 3 of them are bound to a dataset and
the last one is not. The last one is check box. The check box is defined as
follow:
<asp:TemplateField HeaderText="Select">
<ItemTemplate>
<asp:CheckBox ID="chkSelect" runat="server" />
</ItemTemplate>
</asp:TemplateField>
I am trying to read the state of these checkbox using the folllwng code:
// Select the checkboxes from the GridView control
for (int i = 0; i < GridView_Enterprise_name.Rows.Count; i++)
{
GridViewRow row = GridView_Enterprise_name.Rows;
bool isChecked =
((CheckBox)row.FindControl("chkSelect")).Checked;
if (isChecked)
{
// do something
}
}
but the code doesn't work as isChecked is always false. What is the problem
and how can I solve it?
Regards