Solved

How do I programmatically  select a specific items from my dropdown list.

Posted on 2010-09-01
2
292 Views
Last Modified: 2013-12-17
I have a DropdownList1 it uses sqldatasource1 to get the states but I want the first state on pageload to be MN.  How do I get it to show MN?  MN is item 6 in the db.

This is what I have now:

if (!IsPostBack)
        {
            string x = "6";
            x = DropDownList1.SelectedItem;
        }
0
Comment
Question by:bmanmike39
2 Comments
 
LVL 7

Accepted Solution

by:
jdavistx earned 500 total points
ID: 33582718
DropDownList1.SelectedIndex = 5;
0
 

Author Closing Comment

by:bmanmike39
ID: 33582764
Thanks!
0

Featured Post

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

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

Suggested Solutions

For those of you who don't follow the news, or just happen to live under rocks, Microsoft Research released a beta SDK (http://www.microsoft.com/en-us/download/details.aspx?id=27876) for the Xbox 360 Kinect. If you don't know what a Kinect is (http:…
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
Internet Business Fax to Email Made Easy - With  eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, f…
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).

910 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now