Click here to Skip to main content
15,891,943 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Displaying to CheckBoxList Comma separated values from single column database in asp.net with c#

for eg:

Transfer Certificate,Passport sized Photographs,Transportation Form,School Parent Agreement Form

4 String insert in Single Column

then Access the Checkboxlist related the value can checkbox can checked....???
Posted

1 solution

If i understand your question corrctly, you want to populate a checkbox list with elements from a comma sperated list?

That's easy if you use the addrange method:

C#
Page_Load(object sender, EventArgs e){
  if(!IsPostback)
     LoadcheckboxList();
}

private void LoadCheckboxList(){
  var csvTypeLikeColumn = "Certificate,Passport,..";
  var cbl = new CheckBoxList();
  cbl.Items.AddRange(csv.Split(",".ToCharArray()));
}
 
Share this answer
 
Comments
krishna97 2-Apr-14 8:00am    
Value Can Access From Data base table..??
Thomas Nielsen - getCore 2-Apr-14 8:01am    
I suppose your database table column would be some sort of appropriate length varchar or nvarchar and that will translate into a string in .net when you read it.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900