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

前端 未结 7 859
时光取名叫无心
时光取名叫无心 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 02:18

    You can use Master property of your page and access to your property

    Link : http://msdn.microsoft.com/fr-fr/library/system.web.ui.page.master.aspx

    Sample

    ContentPlaceHolder mpContentPlaceHolder;
        TextBox mpTextBox;
        mpContentPlaceHolder = 
          (ContentPlaceHolder)Master.FindControl("ContentPlaceHolder1");
        if(mpContentPlaceHolder != null)
        {
            mpTextBox = 
                (TextBox) mpContentPlaceHolder.FindControl("TextBox1");
            if(mpTextBox != null)
            {
                mpTextBox.Text = "TextBox found!";
            }
        }
    

提交回复
热议问题