Click here to Skip to main content
15,891,904 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
how can i get the column of one table to get in the dropdownlist for the values are used as reference
Eg:-
if i have an emp table and i want the empid detail in the dropdownlist where the dropdownlist is used in other page as reference of my emp table
Posted
Comments
Ankur\m/ 19-Oct-11 7:46am    
select empid from employee_table
Bind the result set to the dropdownlist.

Is it what you want? The question isn't very clear.

 
Share this answer
 
Try this

C#
SqlCommand cmd=new SqlCommand()
cmd.commandtext="Select * from Emp";
//assign connection

DropdownList.DataSource=cmd.ExecuteReader();
DropdownList.DataValueField="Empid";
DropdownList.DataTextField="Empname";


Your dropdown will display employees name and in database it'll store employees id
 
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