Server Side Custom Validation For Number.
it is check regular expression for Number and must be not null value means
Required Field Validation.
CustomValidation.aspx
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="CustomValidation.aspx.cs"
Inherits="CustomValidation" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>CustomValidation ASPdotNet-Example.blogspot.com</title>
</head>
<body>
<form id="form1" runat="server">
<center>
<h1>
CustomValidation ASPdotNet-Example.blogspot.com</h1>
<div>
<table>
<tr>
<td>
</td>
<td>
<asp:CustomValidator ID="CustomValidatorNumber" runat="server" ForeColor="Red"
ControlToValidate="txtValidation" ValidationGroup="Number"
onservervalidate="CustomValidatorNumber_ServerValidate"
ValidateEmptyText="True"></asp:CustomValidator>
</td>
</tr>
<tr>
<td>
<asp:Label ID="lblNumber" runat="server" Text="Number"></asp:Label>
</td>
<td>
<asp:TextBox ID="txtValidation" ValidationGroup="Number" runat="server">
</asp:TextBox>
</td>
</tr>
<tr>
<td>
</td>
<td>
<asp:Button ID="btnSubmit" runat="server" Text="Submit" ValidationGroup="Number"
onclick="btnSubmit_Click" />
</td>
</tr>
<td>
</td>
<td>
<asp:Label ID="lblMsg" runat="server" ForeColor="Green"></asp:Label>
</td>
</table>
</div>
</center>
</form>
</body>
</html>
CustomValidation.aspx.cs