.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
 
Sign In
Register
 
Win Surprise Gifts!!!
Congratulations!!!


Top 5 Contributors of the Month
david stephan

Home >> Forum >> ASP.Net >> Post New QuestionBookmark and Share Subscribe to Forum

Retrieve values from database and store it into checkboxlist control in asp.net 2005?

Posted By: sheeba     Posted Date: April 09, 2011    Points:5   Category :ASP.Net
Hi

My Problem:

I have 2 radiobuttons.Single batch and multiple batch...
I have checkboxlist which contains music,books,tv,mouse etc...

if i select multiple batch 1 dropdown will display...here i have no problem...when i select multiple batch above details loaded to my checkboxlist...then i select single batch,after select to multiple batch,this 4 details will be doubled...
that means music,books,tv,mouse,music,books,tv,mouse...
like that....


Responses
Author: Catherine             
Posted Date: April 09, 2011     Points: 20   

hi try this in pageload
connectionstring=""
if (!Page.IsPostBack)
{
sqlcon.Open();
sqlcmd = new SqlCommand("select eno,empname from emp",sqlcon);
da = new SqlDataAdapter(sqlcmd);
da.Fill(ds);
checkbox1.DataSource = ds;
checkbox1.DataTextField = "empname";
checkbox1.DataBind();
checkbox1.Items.Insert(0, new ListItem("--Select--", "--Select--"));
}



Post Reply

You must Sign In To post reply
 
 
Find more Forum Questions on C#, ASP.Net, Vb.Net, SQL Server and more Here
Quick Links For Forum Categories:
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  OOPs  SilverlightIISJQuery
JavaScript/VBScriptBiztalkWPFPatten/PracticesWCFOthers
www.DotNetSpark.comUnAnsweredAll

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend