母版页

简介: 1. 在整个站点中应用母版页  2.动态应用母版页 void Page_PreInit (Object sender, EventArgs e) { Page.

1. 在整个站点中应用母版页 

<configuration>
  <system.web>
    <pages masterPageFile="~/Site.master" />
  </system.web>
</configuration>

2.动态应用母版页

void Page_PreInit (Object sender, EventArgs e)
{
    Page.MasterPageFile = "~/Site.master";
}

3.操作模板页中的控件(两种方式:强类型与弱类型)

 

img_1c53668bcee393edac0d7b3b3daff1ae.gif img_405b18b4b6584ae338e0f6ecaf736533.gif 代码
 
  
强类型:

< asp:Label ID = " Title " RunAt = " server " />
.
.
.
< script language = " C# " runat = " server " >
public string TitleText
{
get { return Title.Text; }
set { Title.Text = value; }
}
</ script >



Master.TitleText
= " Orders " ;


弱类型:
< asp:Label ID = " Title " RunAt = " server " />


((Label) Master.FindControl (
" Title " )).Text = " Orders " ;

              

 

 

 
目录
相关文章
53EasyUI 树形菜单- 创建带复选框的树形菜单
53EasyUI 树形菜单- 创建带复选框的树形菜单
38 0
50EasyUI 树形菜单- 使用标记创建树形菜单
50EasyUI 树形菜单- 使用标记创建树形菜单
36 0
|
Web App开发 开发框架 JavaScript
|
数据安全/隐私保护 .NET 开发框架
|
.NET Windows 开发框架