Click here to Skip to main content
15,881,281 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hi,

Here my problem is i want to show data from DB thats doesn't matter but how to select particular data at the same time i want to selected item true which is shown in dropdown list

Example:

Here i am having tax table i will show tax percentage from tax_TB and i want selected item true which i gave in query with condition

Thank You !
Posted
Updated 19-Jul-14 1:01am
v2
Comments
Ankit Patel(AP) 19-Jul-14 5:56am    
i dont know what problem you face out .. can you explain with proper example so i can help you.

Thanks
prasanna.raj 19-Jul-14 6:10am    
I want to show All the data from Tax_TB and at the same time when if i give any particular tax amt that's will be display as selected
[no name] 19-Jul-14 6:15am    
In no way does that vague sentence explain to us what it is that you have tried or what the problem is with what you have tried.
Dilan Shaminda 19-Jul-14 6:23am    
do you want to programmatically select an item in dropdownlist after data bind to the dropdownlist?
prasanna.raj 19-Jul-14 6:55am    
yes Hard_Rockz

1 solution

You can Select the item you want in following ways,

dropdownlist.Items.FindByValue("Value").Selected = true;

or
SQL
dropdownlist.SelectedIndex =
    dropdownlist.Items.IndexOf(dropdownlist.Items.FindByValue("Value"))
 
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