Master Page Controls

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
 
M

Mark Rae

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!";
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,770
Messages
2,569,583
Members
45,073
Latest member
DarinCeden

Latest Threads

Top