Solved

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

Posted on 2010-09-01
2
290 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
Comment Utility
DropDownList1.SelectedIndex = 5;
0
 

Author Closing Comment

by:bmanmike39
Comment Utility
Thanks!
0

Featured Post

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

User art_snob (http://www.experts-exchange.com/M_6114203.html) encountered strange behavior of Android Web browser on his Mobile Web site. It took a while to find the true cause. It happens so, that the Android Web browser (at least up to OS ver. 2.…
A long time ago (May 2011), I have written an article showing you how to create a DLL using Visual Studio 2005 to be hosted in SQL Server 2005. That was valid at that time and it is still valid if you are still using these versions. You can still re…
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.

772 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

12 Experts available now in Live!

Get 1:1 Help Now