Solved

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

Posted on 2007-03-27
2
191 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
Comment Utility
You have to add a blank option to the dropdown list.

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

Author Comment

by:jim_bob_jim
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

IntroductionWhile developing web applications, a single page might contain many regions and each region might contain many number of controls with the capability to perform  postback. Many times you might need to perform some action on an ASP.NET po…
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…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…

763 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