Bind CheckBoxList with Database in Asp.Net |
|
Answered By
Moderator1
on
3/12/2010 12:29:04 AM |
|
|
|
|
Hi,
I'm not clear about your question. Anyhow, I have given sample code to bind the CheckBoxList with records from Database.
string sql = "Select * from Customers1";
SqlDataAdapter da = new SqlDataAdapter(sql, "YourConnectionString");
DataTable dtSelect = new DataTable();
da.Fill(dtSelect);
CheckBoxList1.DataSource = dtSelect;
CheckBoxList1.DataValueField = "CustomerName";
CheckBoxList1.DataTextField = "CustomerName";
CheckBoxList1.DataBind(); |
|
|
|