checkbox always "false" in GridView

T

trint

i have this in the html view:
<asp:TemplateField HeaderText ="Remove?">
<ItemTemplate>
<asp:CheckBox ID="removeSelect1" runat="server" />
</ItemTemplate>
<HeaderTemplate>
</HeaderTemplate>
<HeaderStyle ForeColor="White" />
</asp:TemplateField>

and this in my c# file:
foreach (GridViewRow row in GridView2.Rows)
{
bool isChecked = ((CheckBox)row.FindControl("removeSelect1")).Checked;
}

isChecked is always "false" even when checked. Any help is
appreciated.
Thanks,
Trint
 
T

trint

i have this in the html view:
<asp:TemplateField HeaderText ="Remove?">
<ItemTemplate>
<asp:CheckBox ID="removeSelect1" runat="server" />
</ItemTemplate>
<HeaderTemplate>
</HeaderTemplate>
<HeaderStyle ForeColor="White" />
</asp:TemplateField>

and this in my c# file:
foreach (GridViewRow row in GridView2.Rows)
{
bool isChecked = ((CheckBox)row.FindControl("removeSelect1")).Checked;

}

isChecked is always "false" even when checked. Any help is
appreciated.
Thanks,Trint

Nevermind. I figured it out. On the GridView, all I did to make it
read the checkbox was EnableViewState to False.
Trint
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top