技术开发 频道

使用master页面


【IT168技术文档】

  内容页指定要使用的Master页面的方式
  1.在内容页的page指令中使用MasterPageFile属性即可:
<%@ Page Language="c#" MasterPageFile="~/Master.master" %>
  2.在Web.config文件中指定
<configuration> <system.web> <pages masterPageFile="~/Master.master" /> </system.web> </configuration>
  此设置会使应用程序创建的所有内容页面都继承指定的Master页面。只要在内容页面中声明MasterPageFile,就可以覆盖Web.config中的 设定。
  3.如果要把Master应用于一个文件夹中的所有页面:
<configuration> <location path="sub文件夹"> <system.web> <pages masterPageFile="~/Master.master" /> </system.web> </location> </configuration>
  上面的path属性可以是文件夹,也可以是一个具体的aspx页面。
0
相关文章