Validation By Control ASP.Net

<%@ Page Language="C#" AutoEventWireup="true"  CodeFile="Default.aspx.cs" Inherits="_Default" %>



    Untitled Page


    
    

                           runat="server" 
                   Font-Bold="True" 
                   Font-Size="Large" 
                   Text="ASP.NET Validators"/>
                           runat="server" 
                   Font-Bold="True" 
                   Text="Required Field:"/>
                             runat="server">Name
                                            runat="server" 
                                    ControlToValidate="txtRequiredField"
                                    ErrorMessage="No data." 
                                    InitialValue="Please enter your name"/>
                           runat="server" 
                   Font-Bold="True" 
                   Text="Range 0 - 100:"/>
        
                                    runat="server" 
                            ControlToValidate="txtRange"
                            ErrorMessage="Should be between 0 and 100." 
                            MaximumValue="100" 
                            MinimumValue="0"
                            Type="Integer"/>
                             runat="server" 
                    Font-Bold="True" 
                    Text="Regular Expression:"/>
         
                             ID="RegularExpressionValidator1" 
                    runat="server" 
                    ControlToValidate="txtRegExp"
                    ErrorMessage="Please enter a valid US SSN." 
                    ValidationExpression="\d{3}-\d{2}-\d{4}"/>
                             runat="server" 
                    Font-Bold="True" 
                    Text="Value < 20"/>
         
                             ID="CompareValidator1" 
                    runat="server" 
                    ControlToValidate="txtComparison"
                    ErrorMessage="Enter a value less than 20." 
                    Operator="LessThan" 
                    ValueToCompare="20"/>
         
         
    

    


File: Default.aspx.cs
using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
public partial class _Default : System.Web.UI.Page 
{
    protected void btnPostback_Click(object sender, EventArgs e)
    {
        lblValidationComplete.Text = "You passed validation!";
    }
}