码迷,mamicode.com
首页 > 其他好文 > 详细

母版页

时间:2018-05-23 02:30:59      阅读:132      评论:0      收藏:0      [点我收藏+]

标签:扩展名   oid   页面   protect   用户   asp.net   tar   net   必须   

母版页是一个扩展名为.master的ASP.NET文件,主要是为了应用程序创建统一的用户功能界面和样式。

ContentPlaceHolder控件只能在母版页中使用,在平常的web页面使用,会发生解析器错误。

内容页中可以有多个Content服务器控件,但内容页里的Content控件的ContentPlaceHolderID必须与
ContentPlaceHolder控件的ID属性相同。

每个页面中vs会自动加入Content控件,它会自动覆盖母版页的ContentPlaceHolder里的内容,如果
需要展示ContentPlaceHolder控件的内容,不能再内容页加Content控件。

在内容页的Page_PreInit事件可以设置母版页的加载。
代码为
protected void Page_PreInit(object sender, EventArgs e)
{
Page.MasterPageFile = "MyMaster2.master";
}

母版页

标签:扩展名   oid   页面   protect   用户   asp.net   tar   net   必须   

原文地址:https://www.cnblogs.com/rain615/p/9074691.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!