Access Master Page Control Properties

来源:互联网 发布:三亚网络监管局 编辑:程序博客网 时间:2024/06/06 00:00

 

There are two methods to access Master Page Control Properties.

 

  1. User find control
     
    Label lbl = (Label)Master.FindControl("Label1");

 

  1. User @MasterType
    Add
    <%@ MasterType VirtualPath="~/Master/Default.master"%> to the content page
    Then I can use code below to set the label in master page or get the value from master page

 Label2.Text = Master.address;

 Master.label1text = "successful";