Click here to Skip to main content
15,867,756 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i m using the dropdownlist. I m giving the datatextfield= name
and datavaluefield=id
now i want to retreive the id of the particular name which is selected in dropdownlist.
Please tell me how to do it


thanks in advance
Posted

The Best approach will be:

var res = dropDownList.SelectedItem;

You get whole result, then start processing required items
 
Share this answer
 
String ans="";
ans=dropdownlist1.SelectedItem.Value;
 
Share this answer
 
TextBox1.Text=datatextfield.SelectedValue.ToString()
 
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