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?
LVL 8
CamilliaAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

ddayx10Commented:
If I understand your question clearly yes <see snippet>.

Pretty much psuedo-code but it should be really close. If you know how to do it with a repeater this should be pretty similar.

Here's an article:
http://www.4guysfromrolla.com/webtech/072701-1.shtml

If you want different approach its pretty much out there with google (radiobuttonlist databind sqldatasource for example).
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 = dr["Name"].ToString();
        rbl.DataValueField = dr["OfficeId"].ToString();
        rbl.DataBind();

Open in new window

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
ddayx10Commented:
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

0
ddayx10Commented:
Ah jeez I'm going to bed. Too sleepy to pay any attention properly. Anyway same deal with checkboxlist as radiobuttonlist.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
ASP.NET

From novice to tech pro — start learning today.