I have a Validator which is validating a dropdownbox. When the user loads this page the validator doesnt kick in as the first item is already selected/entered by default.
How could i set the validator to ignore value 1 from the dropdown box? Which event should i program it against, if any?
========================================================================
Please remember to mark the replies as answers if they help and unmark them if they provide no help.
Plz do click "Mark as Answer" on the post that helped you. This will also give you point and help readers to know which post solved your issue and make their search easy.
Member
288 Points
1286 Posts
Validator and Dropdown box
Oct 30, 2009 06:44 AM|uid250511|LINK
I have a Validator which is validating a dropdownbox. When the user loads this page the validator doesnt kick in as the first item is already selected/entered by default.
How could i set the validator to ignore value 1 from the dropdown box? Which event should i program it against, if any?
Thanks
Participant
800 Points
242 Posts
Re: Validator and Dropdown box
Oct 30, 2009 07:35 AM|linick|LINK
Hi,
Set the InitialValue property of the validator to the default value.
<div style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;" id="_mcePaste"><asp:DropDownList ID="ddlProjects" runat="server" Width="210px"></div> <div style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;" id="_mcePaste"> </asp:DropDownList></div> <div style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;" id="_mcePaste"> <asp:RequiredFieldValidator ID="RequiredFieldValidator10" runat="server" ControlToValidate="ddlProjects"</div> <div style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;" id="_mcePaste"> ErrorMessage="Please select project" InitialValue="0" ValidationGroup="SavePurchases">*</asp:RequiredFieldValidator></div>========================================================================
Please remember to mark the replies as answers if they help and unmark them if they provide no help.
Participant
1541 Points
450 Posts
Re: Validator and Dropdown box
Oct 30, 2009 07:43 AM|nimish_soft|LINK
set InitialValue="0" on asp:RequiredFieldValidator
Software Developer
IndiaMART InterMESH Limited, Noida
For Free ASP.NET & Oracle Code Snippets
Follow: http://nimishgarg.blogspot.com/
Plz do click "Mark as Answer" on the post that helped you. This will also give you point and help readers to know which post solved your issue and make their search easy.
All-Star
78951 Points
16373 Posts
Re: Validator and Dropdown box
Oct 30, 2009 09:20 AM|ramiramilu|LINK
Hello,
Use....
Thanks.
JumpStart