Master Page Controls

  • Thread starter Thread starter Paul Cheetham
  • Start date Start date
P

Paul Cheetham

Hi,

Can anyone tell me how I can access a control on the Master page from a
client page?

I have a user control on my master page in to which I want to put some
common functions etc.
I can't work out how to reference this from one of my pages.


thankyou.


Paul
 
Can anyone tell me how I can access a control on the Master page from a
client page?

Assuming by "client" page you actually mean "content" page...

Place the following control in your master page:

<asp:Label ID="MyMasterPageLabel" runat="server" />

In the code of your content page e.g. the Page_Load method, do the
following:

((Label)this.Master.FindControl("MyMasterPageLabel")).Text = "Hello!";
 
Back
Top