Click here to Skip to main content
16,004,782 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I created a dropdown list which populate from a database when I click the save button I would like for the code to search through the data in the table column and if exist insert uniqueID instead of the text in the dropdown list.


Is this possible. if so can I get and example of the code or a link to something similar.
Posted

if your dropdown list is bound with data base then u can use value property for ID which is primary key or unique key and Text property for text which display.
 
Share this answer
 
Comments
postonoh 6-May-10 9:47am    
can you give me generic example
postonoh 29-Aug-10 20:54pm    
example code please
yeah...it's very easy

see here ADO .NET examples[^]
 
Share this answer
 
I'll assume your platform is ASP.NET. See the following:

ListItem[^]
ListItem.Text[^]
ListItem.Value[^]

You can just set the text to one thing and the value to another. You will need that to do what you're trying to do. Just use the 'value' member when constructing your database statement.
 
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