Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Reference control from within master page?

Status
Not open for further replies.

bobetko

Programmer
Jan 14, 2003
155
US
Is this possible?

Let's say I have two files:

"mymaster.master" with button control

and

"default.aspx" with textbox control.

When I click on the button (on master) I want to populate textbox (on default.aspx).

Thanks.
 
I will answer my own question:

First, public property has to be created on the master page. This property will have access to all controls and public variables on the master page. In the Master's page Code File enter something like:
Code:
public String SetMyProp
{
    set { lblMyLabel.Text = value; } 
}

Then in content page enter:

Code:
((MasterPage)Master).SetMyProp = "Sample Text";

This will set label's text property on the master page to contain text "Sample Text".

Here is nice article about master pages with samples:
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top