惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

T
Threat Research - Cisco Blogs
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
V
Vulnerabilities – Threatpost
GbyAI
GbyAI
P
Proofpoint News Feed
L
LINUX DO - 热门话题
P
Palo Alto Networks Blog
A
About on SuperTechFans
T
Tenable Blog
M
MIT News - Artificial intelligence
IT之家
IT之家
I
Intezer
D
DataBreaches.Net
爱范儿
爱范儿
T
Threatpost
C
CERT Recently Published Vulnerability Notes
云风的 BLOG
云风的 BLOG
博客园 - 三生石上(FineUI控件)
WordPress大学
WordPress大学
K
Kaspersky official blog
大猫的无限游戏
大猫的无限游戏
A
Arctic Wolf
Y
Y Combinator Blog
Cyberwarzone
Cyberwarzone
酷 壳 – CoolShell
酷 壳 – CoolShell
D
Darknet – Hacking Tools, Hacker News & Cyber Security
H
Help Net Security
Microsoft Security Blog
Microsoft Security Blog
Spread Privacy
Spread Privacy
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
AWS News Blog
AWS News Blog
博客园 - 聂微东
C
Check Point Blog
S
Securelist
有赞技术团队
有赞技术团队
雷峰网
雷峰网
aimingoo的专栏
aimingoo的专栏
Last Week in AI
Last Week in AI
Stack Overflow Blog
Stack Overflow Blog
MongoDB | Blog
MongoDB | Blog
D
Docker
G
GRAHAM CLULEY
T
The Exploit Database - CXSecurity.com
C
Cybersecurity and Infrastructure Security Agency CISA
T
Tailwind CSS Blog
L
Lohrmann on Cybersecurity
G
Google Developers Blog
C
Cyber Attacks, Cyber Crime and Cyber Security
L
LangChain Blog

博客园 - oscar_expansion

test - oscar_expansion - 博客园 WebPart Templates for VS.NET下载地址链接 易用性就这三条原则 将html源代码规范化,转换成XSL代码的asp工具(宝玉师傅) C#入门代码集 - oscar_expansion - 博客园 C#.Net函数和方法集 ASP.NET页面间的传值的几种方法 认识ASP.NET配置文件Web.config 《Asp.Net Forums2.0深入分析》之 Asp.Net Forums是如何实现代码分离和换皮肤的 《Asp.Net Forums2.0深入分析》序(宝玉) Asp.Net Forums2配置文件(web.config)简要说明 URL欺骗之以假乱真 AspNetForums中对于用户权限....... ASP.NET Forums 2.0 新手安装指南 论坛在线人员的一个显示过程(转自ASP.NET Forums 官方中文网站) 日期数据转换为字符串再转换为日期时要注意的一点(转自http://blog.joycode.com/) 彻底删除一个项目中的源代码管理信息(转自http://blog.joycode.com/) 从网络到现实-------美女写的2004高考作文 美国金牌推销员的成功秘诀 -做人做事箴言录
ASP Forum2.0学习笔记之二---了解Master Pages库
oscar_expansion · 2005-06-10 · via 博客园 - oscar_expansion

aspnet forums界面的最关键的问题首先在于它使用了MetaBuilders的Master Pages 控件.
到http://www.metabuilders.com/Tools/MasterPages.aspx处下载此控件来研究一下:

一、Master Pages包括四个类:

(1)Content: This control contains the content for a particular region
此类控件包含真实内容
(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 various Content sections that will be matched to the Master Page's Region controls (based on their ID's).
此控件有两个意图:
·作为一个定位标志,标识Master Page将被插入到页中;
·与Region Controls相匹配
(3)NoBugForm: A server form that does not cause a problem by being inside a master page or other naming container.
无错form。可以放心使用
(4)Region: The control marks a place holder for content in a master page
占位控件

二、我们通过分析default.aspx来看看Master Page使用方式
(1)default.aspx的内容如下:
<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是一个容器,MasterPageFile="~/Themes/MasterPage.ascx是它最重要的属性,指向了一个ascx控件页。其实,这个ascx控件并不是一个真的ascx控件,而是一个页面框架。它提供了default.aspx页面的主结构,然后在其中留出了空白,让default.aspx来填空。
(2)再来仔细看看masterpage.ascx的内容
<html>
<head>
<!--标题-->
<Forums:PageTitle runat="server" />
<!--风格定义-->
<Forums:Style id="Style1" runat="server" />
<!--头标签-->
<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>
首先,它有html文件的<head>,在<head>中留下了不小的地方放自定义控件,Forums:PageTitle 和Forums:Style
然后,在Body中有一个NoBugForm,这个的作用先猜测一下,可能是指用于mp控件的form。
最为重要的是它有一个
<mp:region id="MainContent" runat="server">Default main content</mp:region>
region是一个占位控件,它给谁占的位置呢?看看default.aspx就明白了:
<mp:Content id="MainContent" runat="server">
<Forums:ForumGroupView runat="server" />
</mp:Content>
看到了吗?content中的id与region的id相匹配。结果,default.aspx将会在这儿显示出来。
三、优点考虑:
现在看来master pages的结构也相对简单。但为什么要使用这种方式而不是直接使用ascx控件呢?
关键在于换肤。
asp forums为了实现换肤的方便而使用了一个专门的ascx文件作为框架页。而通常的ascx文件是不可能作为框架页的,它只能是一个页面中的一部分,我们还需要一个aspx或html文件作为框架页。如果框架页改变了,则所有使用此框架的页面全部都要改过。这在dreamweaver中可以使用模板来实现,但也相当不方便。(我没有用过模板,只知道其是自动更改使用模板的页)但使用期master pages结构后只需要改变一个文件或几个文件就可以实现。
好处不少,当然缺点也不可能少。
有什么其它不明之处,我们下回分解。