Click here to Skip to main content
15,942,149 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
I have databound dropdown list. I need to fill data in dropdown list from sql server table data. I have created databound dropdown control in gridview.
Updated 28-Dec-10 20:01pm
Venkatesh Mookkan 29-Dec-10 1:36am    
You are doing a reverse of what your asking for!
thatraja 29-Dec-10 2:36am    
Hi, May I know the reason for down-votes for answers for this question?
Andy_L_J 29-Dec-10 3:28am    
You are downvoting everyone who tries to help you. This will get you a BAD rep on this site an NO-ONE will help you.
Hiren solanki 29-Dec-10 5:09am    
You're changing your question once it's answered and thenafter downvoting everyone. This isn't good practice, are thinking of us as fool ? :mad:

Just now answered for similar question, have this.

DropDownList Inside GridView[^]
Share this answer
I assume that this is in code-behind for a webpage?

Try something like...

box1.DataSource = dt;
box1.TextDataField = "Description"
box1.ValueDataField = "ItemCode"
Share this answer
So what is your problem over there ?

Looks just fine to me.

These is a tedious approach unless one wants custom solution.

Follow below for less coding

a) Fill DataTable using DataAdapter.
b) Assigin dropdownlist DataSource to that DataTable.
c) Set DataSource of Dropdown.
d) Set DataValue of <code>DropDown.

See THIS[^] for more.
Share this answer

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