Drop Down List control and RequiredValidator.InitialValue

  • Thread starter Thread starter Shimon Sim
  • Start date Start date
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.
 
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
 
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.
 
Back
Top