Best is to go for CustomValidators. Below is a sample code for a custom
validator, which checks that a textbox should not have zero value
<asp:CustomValidator
id="CustomValidator1" runat="server"
ErrorMessage="Number not
divisible by Zero"
ControlToValidate="txtNumber"
OnServerValidate="ServerValidate"
ClientValidationFunction="CheckZero"
/><br>
Input:
<asp:TextBox
id="txtNumber" runat="server" />
<script
language="javascript">
<!--function
CheckZero(source, args) {
int val = parseInt(args.Value,
10);
if (value==0) {
args.
IsValid = false;
}
}
// -->
</script>