[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 204
  • Last Modified:

dropdown list select value

I have a dropdown list which I want to force it to select a specific value, is this possible.
0
Mr_Shaw
Asked:
Mr_Shaw
  • 5
  • 3
  • 2
2 Solutions
 
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
 
srikanthreddyn143Commented:
if data is already bound to dropdownlist hten ddlist.selectedindex = index  
0
NEW Veeam Agent for Microsoft Windows

Backup and recover physical and cloud-based servers and workstations, as well as endpoint devices that belong to remote users. Avoid downtime and data loss quickly and easily for Windows-based physical or public cloud-based workloads!

 
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
 
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
 
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

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 5
  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now