Click here to Skip to main content
15,886,095 members
Please Sign up or sign in to vote.
1.00/5 (3 votes)
See more:
please give a solution for that....



Thanks
121ss
Posted
Updated 7-Jan-14 22:12pm
v2
Comments
SarveshShukla 8-Jan-14 3:50am    
There are already tons of article available on internet.Liitle googling will be of help.
CPallini 8-Jan-14 3:56am    
Indeed.
JoCodes 8-Jan-14 4:11am    
Why cant google ????
AmitGajjar 8-Jan-14 4:14am    
Why cant reading some books ?
JoCodes 8-Jan-14 4:25am    
Amit , You have commented to me instead of the OP ...

 
Share this answer
 
You could have googled

try this simple code..

C#
DataTable dt = new DataTable();
               string connectionString = "your connetion string";
               SqlConnection con = new SqlConnection(connectionString);
               SqlDataAdapter adapter = new SqlDataAdapter("SELECT DisplayNameColumn,ValueNameColumn FROM TableName", con);
               adapter.Fill(dt);
               DropDownList1.DataTextField = "DisplayNameColumn";
               DropDownList1.DataValueField = "ValueNameColumn";
               DropDownList1.DataSource = dt;
               DropDownList1.DataBind();



check this link:binding dropdownlist[^]
 
Share this answer
 
v2
Comments
121ss 8-Jan-14 5:30am    
Thanks
Karthik
Karthik_Mahalingam 8-Jan-14 6:36am    
welcome dude :)

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