.aspx
<asp:CheckBox ID="cbxTerms" runat="server" />
<asp:CustomValidator ID="CustomValidator1" runat="server" ErrorMessage="error message" ClientValidationFunction="cbxvalidate"> </asp:CustomValidator>
java script
function cbxvalidate(sender,args)
{
if (document.getElementById('chkbTerms').checked == false)
{
args.IsValid = false
}
}
Note
To call client side page validation manually from java script
Page_ClientValidate() //call this
<asp:CheckBox ID="cbxTerms" runat="server" />
<asp:CustomValidator ID="CustomValidator1" runat="server" ErrorMessage="error message" ClientValidationFunction="cbxvalidate"> </asp:CustomValidator>
java script
function cbxvalidate(sender,args)
{
if (document.getElementById('chkbTerms').checked == false)
{
args.IsValid = false
}
}
Note
To call client side page validation manually from java script
Page_ClientValidate() //call this
No comments:
Post a Comment