E
Ed West
Am getting this error with the following code, particularly this line:
<%# Check(DataBinder.Eval(Container.DataItem, "broker_id"))%>
I am creating checkboxes and the Check function checks to have that
particular checkbox checked by default. I am not using checkboxlist
because I want to EASILY save data to DB with a comma separated list
which HTML gives you if all the checkboxes have the same name.
<asp:datalist id=DataList1 runat="server" RepeatColumns="4">
<ItemTemplate>
<INPUT type=checkbox name=state_ids id='state_id_<%#
DataBinder.Eval(Container.DataItem, "id")%>' value='<%#
DataBinder.Eval(Container.DataItem, "id")%>' <%#
Check(DataBinder.Eval(Container.DataItem, "broker_id"))%> > <%#
DataBinder.Eval(Container.DataItem, "name")%>
</ItemTemplate>
</asp:datalist>
protected string Check(object x) {
if (x != DBNull.Value)
return(" CHECKED");
else
return("");
}
any ideas?
thanks
-ed
<%# Check(DataBinder.Eval(Container.DataItem, "broker_id"))%>
I am creating checkboxes and the Check function checks to have that
particular checkbox checked by default. I am not using checkboxlist
because I want to EASILY save data to DB with a comma separated list
which HTML gives you if all the checkboxes have the same name.
<asp:datalist id=DataList1 runat="server" RepeatColumns="4">
<ItemTemplate>
<INPUT type=checkbox name=state_ids id='state_id_<%#
DataBinder.Eval(Container.DataItem, "id")%>' value='<%#
DataBinder.Eval(Container.DataItem, "id")%>' <%#
Check(DataBinder.Eval(Container.DataItem, "broker_id"))%> > <%#
DataBinder.Eval(Container.DataItem, "name")%>
</ItemTemplate>
</asp:datalist>
protected string Check(object x) {
if (x != DBNull.Value)
return(" CHECKED");
else
return("");
}
any ideas?
thanks
-ed