set property of master page from content page and get that property value from another content page in asp.net

前端 未结 7 923
时光取名叫无心
时光取名叫无心 2021-01-03 01:55

I have a master page with one property name event type. Now I want to set this property from a content page and then that property value should be available to another conte

7条回答
  •  庸人自扰
    2021-01-03 01:59

    Add a property to the master page:

    public string lblBannerText { get { return lblBanner.Text; } set { lblBanner.Text = value; } }
    

    Then, get the master of the page and cast it to the master class type:

    ((MyMaster)Page.Master).lblBannerText = "banner text";
    

提交回复
热议问题