在母板页定义一个服务器控件:
<asp:Label ID="Label1" runat="server" Font-Size="14px" Text="hello"></asp:Label>
在母板也后台代码写上如下代码:
public Lable Lable2
{
get
{
return Label1;
}
set
{
Label1 = value;
}
}
在内容页后台代码获取Lable1:
Lable lable = Master.Lable2;
OK,就这么简单。还有另外一种方法,这里就不说了。
<asp:Label ID="Label1" runat="server" Font-Size="14px" Text="hello"></asp:Label>
在母板也后台代码写上如下代码:
public Lable Lable2
{
get
{
return Label1;
}
set
{
Label1 = value;
}
}
在内容页后台代码获取Lable1:
Lable lable = Master.Lable2;
OK,就这么简单。还有另外一种方法,这里就不说了。