Is page valid : Page Class « Page Lifecycle « ASP.NET Tutorial






<%@ Page Language="vb" %>
<html>
   <head>
      <title>IsValid property example</title>
      <script runat="server">
         Sub Page_Load()
            If IsPostBack Then
               Page.Validate()
               If Page.IsValid Then
                  myMessage.Text = "Page is valid."
               Else
                  myMessage.Text = "Page is not valid."
               End If
            End If
         End Sub
      </script>
   </head>
<body>
   <form runat="server">
      Enter your name:
      <asp:textbox id="name" runat="server"/>
      <asp:requiredfieldvalidator 
         id="rfvName"
         controltovalidate="name"
         enableclientscript="false"
         errormessage="Required!"
         runat="server"/>
      <br/>
      <asp:button id="submit" Text="Submit" runat="server"/>
      <br/>
      <asp:label id="myMessage" runat="server"/>
   </form>
</body>
</html>








5.1.Page Class
5.1.1.Fundamental properties in The Page Class
5.1.2.aspx page inherits from a 'Page' class (C#)
5.1.3.aspx page inherits from a 'Page' class (vb.net)
5.1.4.Expose the control through a page property
5.1.5.Page.ErrorPage
5.1.6.Page.HasControls
5.1.7.Is page valid
5.1.8.Page.ResolveUrl