asp.net Forums Page Model analysis

Source: Internet
Author: User

Details can refer to MSDN (Ms-help://ms. Msdnqtr.v80.chs/ms. Msdn.v80/ms. visualstudio.v80.chs/dv_aspnetcon/html/81b13e7a-b95b-4285-906f-d2dd77411417.htm).

The code-behind page model is used in asp.net forums pages, but slightly different from the typical code-behind page model.

The contents of Default.aspx are as follows:

<%@ Page Language="C#" %>
<%@ Import Namespace="AspNetForums.Components" %>
<%@ Register TagPrefix="Forums" Namespace="AspNetForums.Controls" Assembly="AspNetForums.Controls" %>
<%@ Register TagPrefix="mp" Namespace="MetaBuilders.WebControls.MasterPages" Assembly="MetaBuilders.WebControls.MasterPages" %>
<mp:ContentContainer runat="server" id="MPContainer" MasterPageFile="~/Themes/MasterPage.ascx">
   <mp:Content id="HeadTag" runat="server">
   <meta http-equiv="Refresh" content="300" />
   </mp:Content>
   <mp:Content id="MainContent" runat="server">
     <Forums:ForumGroupView runat="server" />
   </mp:Content>
</mp:ContentContainer>
Let's first familiarize ourselves with the asp.net instruction syntax: Specifies the settings that are used when the page and user control compilers work with ASP.net Web Forms page (. aspx) and user control (. ascx) files.

The ASP.net page framework supports the following directives:

The @ Page defines page-specific properties that are used by the ASP.net page parser and the compiler. Can only be included in the. aspx file.

The @ Control defines the specific properties of the controls that are used by the ASP.net page parser and compiler. Can only be included in an. ascx file (user control).

The @ Import explicitly imports a namespace into a page or user control.

The @ Register Associates aliases with namespaces and class names, allowing user controls and custom server controls to be rendered when included in the requested page or user control.

@ Assembly Links the assembly to the current page during compilation so that all of the Assembly's classes and interfaces are available on the page.

According to the instruction Grammar grammar we read default.aspx:

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

http://www.knowsky.com Specifies that the language used for compiling all inline rendering (<%%> and <%=%>) and code declaration blocks in the page is C #

<%@ Import namespace= "Aspnetforums.components"%>

Explicitly import namespaces to ASP. NET Web page, all classes and interfaces for the imported namespaces are available for use in the file.

<%@ Register tagprefix= "Forums" namespace= "Aspnetforums.controls" assembly= "Aspnetforums.controls"%>

Creates a tag prefix forums that is associated with a namespace Aspnetforums.controls in assembly Aspnetforums.controls.

<%@ Register tagprefix= "MP" namespace= "MetaBuilders.WebControls.MasterPages" assembly= " MetaBuilders.WebControls.MasterPages "%>" (abbreviated)

Continue to look at the page section, which is primarily the usage of the Metabuilders Master pages control, which can be referenced in Venjiang's article (see Master Pages Library), similar to the masterpage in asp.net 2.0

<mp:ContentContainer runat="server" id="MPContainer" MasterPageFile="~/Themes/MasterPage.ascx">
   <mp:Content id="HeadTag" runat="server">
   <meta http-equiv="Refresh" content="300" />
   </mp:Content>
   <mp:Content id="MainContent" runat="server">
     <Forums:ForumGroupView runat="server" />
   </mp:Content>
</mp:ContentContainer>

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.