<%@ 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">My Initial Value</asp:TextBox> <asp:RequiredFieldValidator ID="RequiredFieldValidator1" Runat="server" ErrorMessage="Please change value" ControlToValidate="TextBox1" InitialValue="My Initial Value"/> <asp:RequiredFieldValidator ID="RequiredFieldValidator2" Runat="server" ErrorMessage="Do not leave empty" 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>