Validation ASP.Net Tutorial

<%@ Page Language="C#" %>
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

    void btnLogin_Click(Object sender, EventArgs e)
    {
        if (Page.IsValid)
            lblLoginResult.Text = "Log in successful!";
    }
    void btnRegister_Click(Object sender, EventArgs e)
    {
        if (Page.IsValid)
            lblRegisterResult.Text = "Registration successful!";
    }



    Show Validation Groups


    
    
    

    Login
            id="lblUserName"
        Text="User Name:"
        AssociatedControlID="txtUserName"
        Runat="server" />
    
            id="txtUserName"
        Runat="server" />
            id="reqUserName"
        ControlToValidate="txtUserName"
        Text="(Required)"
        ValidationGroup="LoginGroup"
        Runat="server" />
    
            id="lblPassword"
        Text="Password:"
        AssociatedControlID="txtPassword"
        Runat="server" />
    
            id="txtPassword"
        TextMode="Password"
        Runat="server" />
            id="reqPassword"
        ControlToValidate="txtPassword"
        Text="(Required)"
        ValidationGroup="LoginGroup"
        Runat="server" />
            id="btnLogin"
        Text="Login"
        ValidationGroup="LoginGroup"
        Runat="server" OnClick="btnLogin_Click" />
    

            id="lblLoginResult"
        Runat="server" />
    

    
    

    Register
            id="lblFirstName"
        Text="First Name:"
        AssociatedControlID="txtFirstName"
        Runat="server" />
    
            id="txtFirstName"
        Runat="server" />
            id="reqFirstName"
        ControlToValidate="txtFirstName"
        Text="(Required)"
        ValidationGroup="RegisterGroup"
        Runat="server" />
    
            id="lblLastName"
        Text="Last Name:"
        AssociatedControlID="txtLastName"
        Runat="server" />
    
            id="txtLastName"
        Runat="server" />
            id="reqLastName"
        ControlToValidate="txtLastName"
        Text="(Required)"
        ValidationGroup="RegisterGroup"
        Runat="server" />
    
            id="btnRegister"
        Text="Register"
        ValidationGroup="RegisterGroup"
        Runat="server" OnClick="btnRegister_Click" />
    

            id="lblRegisterResult"
        Runat="server" />