Y
yurps
Hello I have a DataList like this
<aspataList 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>
</aspataList>
<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?
<aspataList 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>
</aspataList>
<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?