By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,950 Members | 1,032 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,950 IT Pros & Developers. It's quick & easy.

CheckBox Checked=false when checked in DataList

P: n/a
Hello I have a DataList like this

<asp:DataList id="Questions" Runat="server">
<ItemTemplate>
<table border="1">
<tr>
<td>
<asp:CheckBox ID="Yes" Runat="server"></asp:CheckBox>
<input type="hidden" runat="server" value='<%#
DataBinder.Eval(Container.DataItem, "I_QUESTION_ID") %>' ></input>
</td>
<td>
<%# DataBinder.Eval(Container.DataItem, "V_HEALTH_QUESTION")%>
</td>
</tr>
</table>
</ItemTemplate>
</asp:DataList>
<asp:Button id="DoThis" runat="server" text="go"></asp:Button>

in the click for the button I do this
StringBuilder hqs = new StringBuilder();
foreach(DataListItem dli in Questions.Items)
{
//if ( ((CheckBox)dli.Controls[1]).Checked )
if ( ((CheckBox)dli.FindControl("Yes")).Checked )
hqs.Append( ((HtmlInputHidden)dli.Controls[3]).Value+",");
}

The first item says checked=false even when I checked it.....
Any items?

Nov 19 '05 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.