Posted on: 11/15/2012 12:09:03 AM | Views : 355

Hi,
I am trying to bind the data to a Checkboxlist from SqlDataSource. I created a stored procedure that returns a table with two columns: value(bit) and label(varchar). I would like the checkbox to be selected when value = 1 and unselected when value = 0.
This is the code I have on my aspx page:
<asp:CheckBoxList ID="chkbox1" runat="server" DataSourceID="sdsSource" DataTextField="Label" DataValueField="Value" Enabled="false"> </asp:CheckBoxList> This shows the checkboxlist on the page with correct labels, but no option is selected. I added the code in C# below, but does not work. It looks like it does not see any items in the checkboxlist so it does not even go inside the foreach loop.
public void SelectCheckbox() { foreach (ListIte ...

Go to the complete details ...