What are the different sections to create an ASP.NET Web page?

Are you preparing for IT certification? With practice questions, study notes, interactive quizzes, tips and technical articles, uCertify PrepKits ensure that you get a solid grasp of core technical concepts to ace your certification exam in first attempt.

What are the different sections to create an ASP.NET Web page?

Rating:

An ASP.NET Web page is similar to static HTML pages, but has an .aspx extension instead of .htm or.html file extensions. It consists of server-based processing and provides a user interface for a Web application. A Web page comprises three sections: page directives, code, and page layout. Each section is briefly described in the following manner:

  • Page Directives: Page directives is the first section of an ASP.NET Web page. This section is used to set up the environment on how the page should be processed. In this section, namespaces can be imported and assemblies can be loaded. The following code in a Web page is written in this section:

    <%@ Page Language="C#" %>


  • Code: The code section of a Web page consists of code to handle events that a user has requested from one of the controls of the Web page. This section contains the script block in which all the event-related code are written inside the <script> tag. For example:

    <script runat="server">
       private void CommandButton1_Click(object sender, System.EventArgs event)
       {
          TextBox Text1 = new TextBox();
          Text1.Location = new Point(30,30);
          this.Controls.Add (Text1);
       }
    </script>


    Note: In the above code, the runat="server" indicates that the code will run on the server.


  • Page Layout: The page layout is the last section of a Web page. It consists ofHTML body containing simple text, client and server controls. For example:

    <html>
       <head>
          <title>My first server control</title>
       </head>
       <body>
         <form id="form1" runat="server">
          <asp:Button id="CommandButton1" runat="server"
          onclick="CommandButton1_Click" Text="ClickButton" >
          </asp:Button>
         </form>
       </body>
    </html>


Rating:



Other articles

Click here to Article home

 
uCertify.com | Our Company | Articles | Privacy | Security | Contact Us | News and Press Release | uCertify India
MCSE: MCSA, MCTS, MCITP    JAVA Certification: SCJP, SCWCD Cisco Certification: CCNA, CCENT, A+, Network+, Security+
Oracle Certification: OCP 9i, OCP 10g, OCA 9i, OCA 10g CIW foundation    EC-212-32    CISSP    Photoshop ACE    Adobe Flash ACE
© 2008 uCertify.com. All rights reserved. All trademarks are the property of their respective owners.