网站导航免费论文 原创论文 论文搜索 原创论文 网学软件 学术大家 资料中心 会员中心 问题解答 原创论文 大学论文导航 设计下载 最新论文 下载排行 原创论文 论文源代码
返回网学首页
网学联系
最新论文 推荐专题 热门论文 素材专题
当前位置: 网学 > 编程文档 > ASP.net > 正文

MigratingfromASP.NET1.xtoASP.NET2.0

来源:http://myeducs.cn 联系QQ:点击这里给我发消息 作者: 用户投稿 来源: 网络 发布时间: 12/10/12
layout of the page will be affected.

in short, master pages greatly simplify the task of making a Web application look consistent, regardless of how many pages are involved.

Content Pages

content pages are attached to a master-page and define content for any contentplaceholder controls in the master page. The content page contains <asp:content> controls that reference the <asp:contentplaceholder> controls in the master page through the contentplaceholder ID. The content pages and the master page combine to form a single response.

<%@ page language="VB" master="~/Mysite.master" %><asp:content id="Content1"  contentplaceholderid="LeftSideContent">    <H2>Navigation </h2>    <asp:treeview id="Navigation tree" runat="server"       datasourceid="NavSource"/></asp:content><asp:content id="Content1"  contentplaceholderid="RightSideContent">    <asp:label runat="server">Support section</asp:label></asp:content>

once again, the user actually makes a request for the content page. ASP.NET notices the reference to the master page and renders the master page content in combination with the content page.

Nested Master Pages

in certain instances, master pages must be nested to achieve increased control over site layout and style. For example, your company may have a Web site that has a constant header and footer for every page, but your accounting department has a slightly different template than your IT department.

figure 11. Nested Master Pages

by nesting individual department master pages within the top-level company master page, you can implement high levels of consistency for each department while controlling what can be overridden by content and master pages.

the key point to remember is that the end user requests one page and receives one page, even though the application may be compiling content from multiple master pages and content pages.

Overriding Master Pages

although the goal of master pages is to create a constant look and feel for all of the pages in your application, there may be situations when you need to override certain content on a specific page. To override content in a content page, you can simply use a content control.

to override a master page dynamically, you have to programmatically expose the public properties of the masterpage class, including those you create. Therefore, if you want to override the <title> and <keyword> properties in the <head> section of your HTML pages, you can build a function to edit the default properties set in the master page:

<head runat="server" id="Head1">    <title><% =m_HtmlTitle %></title>     <meta name="keywords" content="<% =GetKeywords() %>" >      <meta name="description"        content="A newsletter focused on meeting the needs of .NET               developers, providing cool tips for the advanced                programmer, and keeping               you informed on what''s happ	 
			

网学推荐

免费论文

原创论文

设为首页 | 加入收藏 | 论文首页 | 论文专题 | 设计下载 | 网学软件 | 论文模板 | 论文资源 | 程序设计 | 关于网学 | 站内搜索 | 网学留言 | 友情链接 | 资料中心
版权所有 QQ:3710167 邮箱:3710167@qq.com 网学网 [Myeducs.cn] 您电脑的分辨率是 像素
Copyright 2008-2015 myeducs.Cn www.myeducs.Cn All Rights Reserved 湘ICP备09003080号