The most critical issue on the ASPNET forums interface is that it uses the metabuilders master pages control. Go to http://www.metabuilders.com/tools/masterpages.aspxto download this configuration to study: I. master pages includes four categories: (1) content: This control contains the content for a particle Region These controls contain real content (2) contentcontainer: This control serves two distincts purposes: -It marks the location where the master page will be inserted into the page-it contains the varous content sections that will be matched to the master page's region controls (based on their ID' s ). This control has two intentions: · As a positioning mark, the master page will be inserted into the page; · Match region controls (3) nobugform: A server form that does not cause a problem by being inside a master page or other naming container. No error form. Easy to use (4) region: the control marks a place holder for content in a master page Placeholder Control 2. Analyze default. aspx to see how the master page is used. (1) The content of default. aspx is as follows: < 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 > MP: contentcontainer is a container, masterpagefile = "~ /Themes/masterpage. ascx is its most important attribute and points to an ascx control page. In fact, this ascx control is not a real ascx control, but a page framework. It provides the main structure of the default. aspx page, and leaves a blank space in it to allow default. aspx to fill in the blanks. (2) take a closer look at masterpage. ascx. < Html > < Head > <! -- Title --> < Forums: pagetitle Runat = "Server" /> <! -- Style Definition --> < Forums: Style ID = "Style1" Runat = "Server" /> <! -- Header label --> < MP: Region ID = "Headtag" Runat = "Server" /> </ Head >
< Body Leftmargin = "0" Topmargin = "0" Marginwidth = "0" Marginheight = "0" >
<! -- * ******** Nobugform: Start *************// --> < MP: nobugform Runat = "Server" >
< MP: Region ID = "Maincontent" Runat = "Server" > Default Main Content </ MP: Region >
</ MP: nobugform > <! -- * ******** Nobugform: End *************// -->
<! -- * ******** Footer: Start *************// --> < Forums: footer Runat = "Server" /> < BR /> <! -- * ******** Footer: End *************// --> </ Body > </ Html > First, it has the Then, there is a nobugform in the body. The role of this may be the form used for the MP control. The most important thing is that it has <MP: Region ID = "maincontent" runat = "server"> default main content </MP: region> Region is a placeholder control. Who does it occupy? Look at default. aspx and you will understand: <MP: Content ID = "maincontent" runat = "server"> <Forums: forumgroupview runat = "server"/> </MP: content> Have you seen it? The ID in content matches the ID of region. As a result, default. aspx is displayed here. Iii. Advantages: Now it seems that the structure of master pages is relatively simple. But why not directly use the ascx control? The key lies in skin replacement. ASP forums uses a dedicated ascx file as the framework page for skin replacement convenience. Generally, an ascx file cannot be used as a framework page. It can only be a part of a page. We also need An ASPX or HTML file as a framework page. If the framework page is changed, all the pages that use this framework must be changed. This can be implemented using a template in Dreamweaver, but it is not convenient. (I have never used a template, but only know that it is automatically changing the page using the template.) However, after using the master pages structure, you only need to change one or several files. For masterpage of Asp.net 2.0, refer: Http://www.microsoft.com/taiwan/msdn/library/2004/oct-2004/masterpages.htm |