dropdown list select value

I have a dropdown list which I want to force it to select a specific value, is this possible.
Mr_ShawAsked:
Who is Participating?
 
ToddBeaulieuCommented:
Selected is an ITEM property. See, this all depends on what you're really trying to accomplish, so it's hard to guess from the original question.

If you know what the text is, you probably need to find the item and either set it to be selected or set the dropdown's selectedindex property = the item's index.

Here's an example:

http://answers.yahoo.com/question/index?qid=20070514035103AA1v20M
0
 
ToddBeaulieuCommented:
Sure. Set the SelectedIndex, or find the item and set it's Selected property = True.
0
 
Mr_ShawAuthor Commented:
There is no selected properted for a dropdown list. Please could you give me an example.
0
Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
srikanthreddyn143Commented:
if data is already bound to dropdownlist hten ddlist.selectedindex = index  
0
 
Mr_ShawAuthor Commented:
I am binding the data from a database so I am not sure of the index value of the item i want to select.
0
 
srikanthreddyn143Commented:
try it

DropDownList.SelectedValue = "somevalue"



0
 
Mr_ShawAuthor Commented:
I need the code to actually selct not just highlight the item in the list.
0
 
srikanthreddyn143Commented:
DropDownList1.Items.FindByText("text here").Selected=true;
DropDownList1.Items.FindByValue("value here").Selected = true;
0
 
Mr_ShawAuthor Commented:
Ok thanks guys for your help.

I figured out the last part of the problem was the order in which I was calling my stored procedures.

I will dish out the point soon.

Thanks
0
 
Mr_ShawAuthor Commented:
thanks
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.