Solved

DropDownList 'Please select' text

Posted on 2009-07-09
4
268 Views
Last Modified: 2013-11-08
I have an ASP DropDownList and I would like to add an Item which reads 'Please Select'. However I don't want the user to be able to select the 'Please Select' item (it would just be for show).

Is this possible
0
Comment
Question by:Mr_Shaw
[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
4 Comments
 
LVL 9

Accepted Solution

by:
Deathrace earned 168 total points
ID: 24814887
You can add an item "Please Select" but i'm not sure whether we cann't select it. Try a sever-side validation, using dropdownlist.selectedtext to identify the items.
if its equal to "Please Select" do nothing
else
do something
0
 
LVL 15

Assisted Solution

by:jinal
jinal earned 166 total points
ID: 24814890
You can put javascript validation for that.

As you are using ASP.net you can use required field validation for that.

<asp:RequiredFieldValidator ID="valid1" runat="server" ControlToValidate="drpDropDown" InitialValue="Please select" />
0
 
LVL 15

Assisted Solution

by:spprivate
spprivate earned 166 total points
ID: 24814942
Try this
dropdownlist.Items(0).Enabled = False
0
 

Author Closing Comment

by:Mr_Shaw
ID: 31601660
thanks
0

Featured Post

How Do You Stack Up Against Your Peers?

With today’s modern enterprise so dependent on digital infrastructures, the impact of major incidents has increased dramatically. Grab the report now to gain insight into how your organization ranks against your peers and learn best-in-class strategies to resolve incidents.

Question has a verified solution.

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

ASP.Net to Oracle Connectivity Recently I had to develop an ASP.NET application connecting to an Oracle database.As I am doing it first time ,I had to solve several problems. This article will help to such developers  to develop an ASP.NET client…
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…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

752 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