Solved

DropDownList 'Please select' text

Posted on 2009-07-09
4
261 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
Comment Utility
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
Comment Utility
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
Comment Utility
Try this
dropdownlist.Items(0).Enabled = False
0
 

Author Closing Comment

by:Mr_Shaw
Comment Utility
thanks
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

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…
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…
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…
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.

762 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

13 Experts available now in Live!

Get 1:1 Help Now