Page.IsValid (VB.net) : IsValid « Page Lifecycle « ASP.NET Tutorial






<%@ Page Language="VB" %>

<script runat="server">
   sub Submit(obj as object, e as eventargs)
      if Page.IsValid then
         lblMessage.Text = "Success!"
      else
         lblMessage.Text = "One of the fields is invalid1"
      end if
   end sub
</script>

<html><body>
   <form runat="server">
      <asp:Label id="lblMessage" runat="server" /><br>
      <asp:Panel id="Panel1" runat="server">
         <table>
         <tr>
            <td>
               First and last name:
            </td>
            <td>
               <asp:TextBox id="tbFName" runat="server" />
               <asp:TextBox id="tbLName" runat="server" />
               <asp:RequiredFieldValidator runat="server" 
                  ControlToValidate="tbFName" 
                  ErrorMessage="First name required"
                  Display="dynamic"/>
               <asp:RequiredFieldValidator runat="server" 
                  ControlToValidate="tbLName" 
                  ErrorMessage="Last name required"
                  Display="dynamic"/>
            </td>
         </tr>
         <tr>
            <td>
               <asp:Button id="btSubmit" runat="server" 
                  text="Add"
                  OnClick="Submit" />
            </td>
         </tr>
         </table>
      </asp:Panel>
   </form>
</body></html>








5.13.IsValid
5.13.1.Page.IsValid (VB.net)