<%@ Page Language="C#" %> <script runat="server"> protected void Button1_Click(Object sender, EventArgs e) { Label1.Text = "Page is valid!"; } </script> <html xmlns="http://www.w3.org/1999/xhtml" > <head id="Head1" runat="server"> <title>RequiredFieldValidator</title> </head> <body> <form id="form1" runat="server"> <div> <asp:TextBox ID="TextBox1" Runat="server"></asp:TextBox> <asp:RequiredFieldValidator ID="RequiredFieldValidator1" Runat="server" ErrorMessage="Required!" ControlToValidate="TextBox1"> </asp:RequiredFieldValidator> <asp:Button ID="Button1" Runat="server" Text="Submit" OnClick="Button1_Click" /> <asp:Label ID="Label1" Runat="server"></asp:Label> </div> </form> </body> </html>