Solved

c# asp.net dropdownlist - how to have it so the first item is not visible

Posted on 2007-03-27
2
193 Views
Last Modified: 2010-04-16
simple question!

I have a number of dropdownLists with auto post back set to true.

dropdownlist 2 is dependent on the selection from dropdownlist 1 etc.....

how can I get it so that when each dropdownlist is populated the first item is not visible as I cannot select that item.  I have to select the second item and then re-select the first item before the next dropdownlist is populated.

I would like maybe for the dropdownlist to prompt the user or just appear blank before a selection is made

any idea guys?

0
Comment
Question by:jim_bob_jim
2 Comments
 
LVL 35

Accepted Solution

by:
mrichmon earned 250 total points
ID: 18800674
You have to add a blank option to the dropdown list.

dropdownlistID.Items.Insert(0, new ListItem("", ""));
0
 

Author Comment

by:jim_bob_jim
ID: 18800739
thanks
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Just a quick little trick I learned recently.  Now that I'm using jQuery with abandon in my asp.net applications, I have grown tired of the following syntax:      (CODE) I suppose it just offends my sense of decency to put inline VBScript on a…
More often than not, we developers are confronted with a need: a need to make some kind of magic happen via code. Whether it is for a client, for the boss, or for our own personal projects, the need must be satisfied. Most of the time, the Framework…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.
Need to grow your business through quality cloud solutions? With everything required to build a cloud platform and solution, you may feel like the distance between you and the cloud is quite long. Help is here. Spend some time learning about the Con…

911 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

19 Experts available now in Live!

Get 1:1 Help Now