<%@ Page Language="VB" %> <script runat="server"> Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Label1.Text = "Page is valid!" End Sub </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" Text="Required!" ErrorMessage="Required!" ControlToValidate="TextBox1"> </asp:RequiredFieldValidator> <br /> <asp:Button ID="Button1" Runat="server" Text="Submit" OnClick="Button1_Click" /> <br /> <br /> <asp:Label ID="Label1" Runat="server"></asp:Label> </div> </form> </body> </html>