First, It is perfectly fine to do it on the client side (I often do it on client side ONLY, though not recommended). Second, from the code your posted before, that the Page.IsValid is true is because you did not test the condition after the postback. Try it again in the event code.
If it does not work, paste the complete yet relevant code, I will check it out.
The following is my testing code:
<%@ Page Language="C#" AutoEventWireup="True" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html >
<head>
<title>CustomValidator ServerValidate Example</title>
<script language="javascript">
function clientValidate(source,args) {
if (args.Value % 2 == 0)
args.IsValid = true;
else
args.IsValid = false;
alert(args.IsValid);
}
</script>
<script runat="server">
void ValidateBtn_OnClick(object sender, EventArgs e)
{
// Display whether the page passed validation.
if (Page.IsValid)
{
Message.Text = "Page is valid.";
}
else
{
Message.Text = "Page is not valid!";
}
}
void ServerValidation(object source, ServerValidateEventArgs args)
{
/* try
{
// Test whether the value entered into the text box is even.
int i = int.Parse(args.Value);
args.IsValid = ((i%2) == 0);
Response.Write("validation " + Page.IsValid);
}
catch(Exception ex)
{
args.IsValid = false;
}*/
}
</script>
</head>
<body>
<form id="form1" runat="server">
<h3>CustomValidator ServerValidate Example</h3>
<asp:Label id="Message"
Text="Enter an even number:"
Font-Names="Verdana"
Font-Size="10pt"
runat="server"
AssociatedControlID="Text1"/>
<br />
<asp:TextBox id="Text1"
runat="server" />
<asp:CustomValidator id="CustomValidator1"
ControlToValidate="Text1"
Display="Static"
ErrorMessage="Not an even number!"
ForeColor="green"
Font-Names="verdana"
Font-Size="10pt"
OnServerValidate="ServerValidation"
runat="server" ClientValidationFunction="clientValidate"/>
<br />
<asp:Button id="Button1"
Text="Validate"
OnClick="ValidateBtn_OnClick"
runat="server"/>
</form>
</body>
</html>