PDA

View Full Version : Set first item in dropdownlist cannot be selected


calvin
07-08-2004, 03:33 AM
Hi,

Is anybody know how to make user unable to select the first item in dropdownlist, normally is "Please select..." on top of dropdownlist and how to validate the dropdownlist (Required field validator)if is selected or not.
Thanks to all giving comments and suggestion.

Calvin[?]

bruce
07-08-2004, 11:40 AM
I don't think you can disable the first item on the drop down.

You could use the Initial Value validation to make sure your user select something.

Do something like this

<asp:RequiredFieldValidator
ControlToValidate="txtbox1"
Text="Enter something"
InitialValue="<Select One>"
Runat="Server"
/>


[b]quote:Originally posted by calvin

Hi,

Is anybody know how to make user unable to select the first item in dropdownlist, normally is "Please select..." on top of dropdownlist and how to validate the dropdownlist (Required field validator)if is selected or not.
Thanks to all giving comments and suggestion.

Calvin[?]
</blockquote id="quote"></font id="quote">

pjoyce
07-08-2004, 12:35 PM
[b]quote:Originally posted by calvin

Hi,

Is anybody know how to make user unable to select the first item in dropdownlist, normally is "Please select..." on top of dropdownlist and how to validate the dropdownlist (Required field validator)if is selected or not.
Thanks to all giving comments and suggestion.

Calvin[?]
</blockquote id="quote"></font id="quote">

Add a required field validator. They are special for drop-downs... if a drop down is still equal to the initial value, it doesn ot pass validatiion.