?
Solved

dropdown list select value

Posted on 2009-05-14
10
Medium Priority
?
202 Views
Last Modified: 2013-12-17
I have a dropdown list which I want to force it to select a specific value, is this possible.
0
Comment
Question by:Mr_Shaw
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 3
  • 2
10 Comments
 
LVL 16

Expert Comment

by:ToddBeaulieu
ID: 24385046
Sure. Set the SelectedIndex, or find the item and set it's Selected property = True.
0
 

Author Comment

by:Mr_Shaw
ID: 24385070
There is no selected properted for a dropdown list. Please could you give me an example.
0
 
LVL 11

Expert Comment

by:srikanthreddyn143
ID: 24385081
if data is already bound to dropdownlist hten ddlist.selectedindex = index  
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 

Author Comment

by:Mr_Shaw
ID: 24385114
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
 
LVL 16

Accepted Solution

by:
ToddBeaulieu earned 1000 total points
ID: 24385166
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
 
LVL 11

Assisted Solution

by:srikanthreddyn143
srikanthreddyn143 earned 1000 total points
ID: 24385218
try it

DropDownList.SelectedValue = "somevalue"



0
 

Author Comment

by:Mr_Shaw
ID: 24385298
I need the code to actually selct not just highlight the item in the list.
0
 
LVL 11

Expert Comment

by:srikanthreddyn143
ID: 24385359
DropDownList1.Items.FindByText("text here").Selected=true;
DropDownList1.Items.FindByValue("value here").Selected = true;
0
 

Author Comment

by:Mr_Shaw
ID: 24385751
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
 

Author Closing Comment

by:Mr_Shaw
ID: 31581448
thanks
0

Featured Post

Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In my previous two articles we discussed Binary Serialization (http://www.experts-exchange.com/A_4362.html) and XML Serialization (http://www.experts-exchange.com/A_4425.html). In this article we will try to know more about SOAP (Simple Object Acces…
This article aims to explain the working of CircularLogArchiver. This tool was designed to solve the buildup of log file in cases where systems do not support circular logging or where circular logging is not enabled
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …
Suggested Courses

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question