Sign In| Join
Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Contributor
3230 Points
668 Posts
Apr 27, 2012 12:56 PM|LINK
hi,
you have to use a javascript method for custom validation on aspx page not the servervalidate event of custom validator
example
<SCRIPT LANGUAGE="JavaScript"> function validatefunction(oSrc, args){ //logic for odd number
} </SCRIPT> <asp:Textbox id="text1" runat="server" text=""> </asp:Textbox> <asp:CustomValidator id="CustomValidator1" runat=server ControlToValidate = "text1" ErrorMessage = "You must enter at least 8 characters!" ClientValidationFunction="validatefunction" > </asp:CustomValidator>
tusharrs
Contributor
3230 Points
668 Posts
Re: CompareValidator and CustomValidator in one Form
Apr 27, 2012 12:56 PM|LINK
hi,
you have to use a javascript method for custom validation on aspx page not the servervalidate event of custom validator
example
<SCRIPT LANGUAGE="JavaScript"> function validatefunction(oSrc, args){ //logic for odd number
} </SCRIPT> <asp:Textbox id="text1" runat="server" text=""> </asp:Textbox> <asp:CustomValidator id="CustomValidator1" runat=server ControlToValidate = "text1" ErrorMessage = "You must enter at least 8 characters!" ClientValidationFunction="validatefunction" > </asp:CustomValidator>
( Mark as Answer if it helps you out )
View my Blog