ASP.NET RegularExpressionValidator - Validate U.S. Zip Code

RegularExpressionValidator - validate U.S. Zip Code
USZipCodeValidation.aspx

<%@ Page Language="C#" %>

<!DOCTYPE html>

<script runat="server">
    protected void Page_Load(object sender, System.EventArgs e)
    { 
        if(!this.IsPostBack)
        {
            Label1.Font.Bold = true;
            Label1.Font.Italic = true;
            Label1.Font.Size = FontUnit.Large;
            Label1.ForeColor = System.Drawing.Color.HotPink;
        }
    }
    protected void Button1_Click(object sender, EventArgs e)
    {
        Label1.Text = "Your Zip Code: " + TextBox1.Text.ToString();
    }
</script>

<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
    <title>asp.net RegularExpressionValidator example: how to validate U.S. Zip Code</title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <h2 style="color:Teal">RegularExpressionValidator: U.S. Zip Code</h2>
        <asp:Label 
             ID="Label1" 
             runat="server"
             >
        </asp:Label>
        <br /><br />
        <asp:Label 
             ID="Label2" 
             runat="server" 
             Text="U.S. Zip Code"
             Font-Bold="true"
             ForeColor="DodgerBlue"
             >
        </asp:Label>
        <asp:TextBox 
             ID="TextBox1" 
             runat="server"
             BackColor="DodgerBlue"
             ForeColor="AliceBlue"
             >
        </asp:TextBox>
        <asp:RequiredFieldValidator 
             ID="RequiredFieldValidator1"
             runat="server"
             ControlToValidate="TextBox1"
             Text="*"
             >
        </asp:RequiredFieldValidator>
        <asp:RegularExpressionValidator 
            ID="RegularExpressionValidator1"
            runat="server" 
            ValidationExpression="\d{5}(-\d{4})?"
            ControlToValidate="TextBox1"
            ErrorMessage="Input valid U.S. Zip Code!"
            ></asp:RegularExpressionValidator>
        <br /><br />
        <asp:Button 
             ID="Button1" 
             runat="server" 
             Text="Submit Zip Code"
             Font-Bold="true"
             ForeColor="Crimson" 
             OnClick="Button1_Click"
             />
    </div>
    </form>
</body>
</html>
More asp.net examples