<asp:CustomValidator ID="CustomValidator1" runat="server" ErrorMessage="CustomField must be an even number!"
ControlToValidate="CustomField" ClientValidationFunction="ValidateEvent"
OnServerValidate="ValidateEvent">
</asp:CustomValidator>
<script type="text/javascript">
function ValidateEvent(oSrc, args)
{
args.IsValid = ((args.Value % 2) == 0);
}
</script>
protected void ValidateEvent(object source, ServerValidateEventArgs args)
{
if ((Convert.ToInt32(args.Value) % 2) == 0)
args.IsValid = true;
else
args.IsValid = false;
}
Thursday, July 9, 2009
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment