I thought that the CheckBoxList databinding would be simlar to DropDownList databinding, and the first part is but I'm not sure where to begin for the "real" databinding.
The items in the CheckBoxList are easily populated from a SqlDataSource, so I have Text for CheckBox1 = "CheckBox1" Value for CheckBox1 = 1, Text for CheckBox2 = "CheckBox2" Value for CheckBox2 = 2 and so on. That of course does not set the Checked state
for any of the CheckBoxes. Asuming that the CheckBoxList is within a FormView and I have a SqlDataSource available that contains two columns, one is a bit which contains the Checked state and the other is a Value which corresponds to the Value from the first
SqlDataSource that was used to populate the list - how do I tell the CheckBoxList to get the Checked state from the second SqlDataSource.
Better yet what if the second data source is not the data source for the FormView that the CheckBoxList is within.
tdinpsp
Member
114 Points
125 Posts
CheckBoxList DataBinding
Sep 09, 2009 06:47 AM|LINK
I thought that the CheckBoxList databinding would be simlar to DropDownList databinding, and the first part is but I'm not sure where to begin for the "real" databinding.
The items in the CheckBoxList are easily populated from a SqlDataSource, so I have Text for CheckBox1 = "CheckBox1" Value for CheckBox1 = 1, Text for CheckBox2 = "CheckBox2" Value for CheckBox2 = 2 and so on. That of course does not set the Checked state for any of the CheckBoxes. Asuming that the CheckBoxList is within a FormView and I have a SqlDataSource available that contains two columns, one is a bit which contains the Checked state and the other is a Value which corresponds to the Value from the first SqlDataSource that was used to populate the list - how do I tell the CheckBoxList to get the Checked state from the second SqlDataSource.
Better yet what if the second data source is not the data source for the FormView that the CheckBoxList is within.
Thanks
checkboxlist