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

MigratingfromASP.NET1.xtoASP.NET2.0

来源:http://myeducs.cn 联系QQ:点击这里给我发消息 作者: 用户投稿 来源: 网络 发布时间: 12/10/12
s available in ASP.NET 2.0.

Master Pages

master pages are a new feature introduced in ASP.NET 2.0 to help you reduce development time for Web applications by defining a single location to maintain a consistent look and feel in a site. Master pages allow you to design a template that can be used to generate a common layout for many pages in the application.

the primary goal of master pages is to avoid creating each page from scratch and having to repeat the layout code. Another benefit of using master pages is that if you want to change the layout of the pages in the application, you only have to update the master page rather than each individual page. This feature is somewhat similar to the Microsoft Windows Form technique of visual Inheritance, available with the original version of the .NET Framework, and is used for desktop application development.

a master page looks like any ordinary ASP.NET Web page, except for the extension (.master instead of .aspx) and some special controls and header fields. Master pages must contain one or more <asp:contentplaceholder> controls. These controls represent areas of replaceable content. Basically, anything that is not in a contentplaceholder will appear on any page that uses the master page.

visual Studio 2005 automatically creates most of this code for you, so you don''t have to write complex HTML code for your page layout. A master page must also include the following default source code:

<%@ master language="C#" compilewith="site.master.cs"      classname="ASP.site_master" %><html><head runat="server"><title>Untitled Page</title></head><body>  <form runat="server">    <asp:contentplaceholder id="ContentPlaceHolder1" runat="server">    </asp:contentplaceholder>  </form></body></html>

other than these key changes, a master page can contain any HTML or control that can be found on a normal ASP.NET page.

although master pages and frames serve a similar purpose, master pages offer much more functionality. Unlike frames, using master pages allow you to:

  • Bookmark a page and recall all the information on the specific page, not just the default frame page. A master page isn''t really a frame. It''s a single page that contains collated content from the master page and the content page that builds on the master. Therefore it looks and acts like a single Web page rather than a frame.
  • Work by means of controls and tags rather than HTML. Thanks to Visual Studio, you don''t have to worry about opening and closing frame tags or modifying countless HTML attributes to ensure that each frame displays in the correct fashion. You can simply create the place holder and modify its properties through Visual Studio.
  • Leverage Visual Studio''s code creation to visually design the layout, manage the frames, and provide all of the plumbing to link the content pages into the master page. You can add new content without having to worry that the overall HTML

网学推荐

免费论文

原创论文

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