佬唐

博客园 首页 新随笔 联系 订阅 管理

一、修改 Master Page 的标题部分

  HtmlHead head=this.Master.Page.Header; 
  //...... 
  HtmlMeta meta=new HtmlMeta();  
  meta.Name="Keywords";  
  meta.Content="xxx网是全宇宙最牛X的网站";  
  head.Controls.Add(meta);

二、 查找MasterPage中的控件(内容页用母版页中的东东)
(1).FindControl方法:this.Master.Page.Form.FindControl("控件名")
(2).在MasterPage定义属性:
public XXX控件类型 MyXXXControl
{
get{return this.XXXControl;}
}
使用时:MasterPage的类名 master = (MasterPage的类名)this.Master;
(3).MasterType指令
在内容页头加入:<%@ MasterType VirtualPath="~/Site1.Master" %>
代码中可直接使用了:this.Master.控件名.BackColor = System.Drawing.Color.Green;


posted on 2008-12-29 10:11  佬唐  阅读(125)  评论(0)    收藏  举报