Solved

DropDownList 'Please select' text

Posted on 2009-07-09
4
263 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
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

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

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

This document covers how to connect to SQL Server and browse its contents.  It is meant for those new to Visual Studio and/or working with Microsoft SQL Server.  It is not a guide to building SQL Server database connections in your code.  This is mo…
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…
Along with being a a promotional video for my three-day Annielytics Dashboard Seminor, this Micro Tutorial is an intro to Google Analytics API data.
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…

786 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