Drop Down List control and RequiredValidator.InitialValue

S

Shimon Sim

hi
It should be easy but I can't make it work.
I have DropDownList. I set first with text and value "Select". Then I add
RequiredValidator and set it InitialValue to "Select" and I expect that the
validator will not allow this value to stay the same but.. Validator never
fires.
What is wrong?
Thank you,
Shimon.
 
P

Patrick.O.Ige

Shimon when you say :- "I set first with text and value "Select". what do
you mean
Can you post what you are trying to do
This sample below works:-
<ASP:DropDownList id=DropDownList1 runat=server>
<asp:ListItem></asp:ListItem>
<asp:ListItem >12/01</asp:ListItem>
</ASP:DropDownList>

<asp:RequiredFieldValidator id="RequiredFieldValidator3"
ControlToValidate="DropDownList1"
ErrorMessage="Expiration Date. "
Display="Static"
InitialValue=""
Width="100%"
runat=server>
*
</asp:RequiredFieldValidator>
Hope that helps
Patrick
 
S

Shimon Sim

My case is the same but the first item had text and value = "select". So
InitialValue property had to be select also.
Anyway I found the problem as I posted.
Shimon.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top