Solved

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

Posted on 2007-03-27
2
194 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

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
tutorial for ebay api 3 35
start a process from a service 3 23
Help with exporting to excel 4 28
DataTables + iCheck + pagination Issue 2 23
Wouldn’t it be nice if you could test whether an element is contained in an array by using a Contains method just like the one available on List objects? Wouldn’t it be good if you could write code like this? (CODE) In .NET 3.5, this is possible…
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…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

832 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