Link to home
Start Free TrialLog in
Avatar of Camillia
CamilliaFlag for United States of America

asked on

Can I bind multiple rows to a checkbox list?

I know this is doable using a repeater, not sure if it's doable using a checkboxlist.

I have a list of offices, i want to display them (name and officeid will be checkbox list id) and have the user check the relevant ones.
Do i have to use a repeater?
ASKER CERTIFIED SOLUTION
Avatar of Member_2_4913559
Member_2_4913559
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
stupid psuedo-code will get you every time...messed that up try again.
System.Data.SqlClient.SqlConnection conn = new System.Data.SqlClient.SqlConnection("someconnstr");
System.Data.SqlClient.SqlCommand cmd = new System.Data.SqlClient.SqlCommand("SELECT OfficeID, Name FROM SomeTable",conn);
conn.Open();
System.Data.SqlClient.SqlDataReader dr = cmd.ExecuteReader();
rbl.DataSource = dr;
rbl.DataTextField = "Name";
rbl.DataValueField = "OfficeId";
rbl.DataBind();

Open in new window

Ah jeez I'm going to bed. Too sleepy to pay any attention properly. Anyway same deal with checkboxlist as radiobuttonlist.