Solved

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

Posted on 2010-09-01
2
296 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
[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
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

Independent Software Vendors: 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!

Question has a verified solution.

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

Introduction This article shows how to use the open source plupload control to upload multiple images. The images are resized on the client side before uploading and the upload is done in chunks. Background I had to provide a way for user…
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
If you're a developer or IT admin, you’re probably tasked with managing multiple websites, servers, applications, and levels of security on a daily basis. While this can be extremely time consuming, it can also be frustrating when systems aren't wor…
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.

705 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