AspdotnetCodes.com
Search
Articles
Books
Resources
Asp.Net News
Downloads
Free Tech Magazines
Asp.Net Web Hosting
Archives
Softwares
Newsletter
Suggest Us
Link to Us
Feeds Subscription
Articles
Questions & Answers
Tips & Tricks
 Checkboxlist
Posted by arun kumar on  3/8/2010 3:13:54 AM Category: Asp.Net 2.0
Add to my favorites
Email to friend
How to fetch data from database using sql on multiple selection of a checkboxlist in c#

Post Your Reply Post New Question

 Viewer's Reply
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();
 
Post Your Reply If you still have problem, post it again under this reply for better response.

 
Sponsored by
Sexy Web Design - Free 71 Page Preview!
Windows 8: 50 Questions and Answers You Need to Make a Decision (Normally $9.95)
Simply JavaScript - Free 150 Page Preview!