Link to home
Start Free TrialLog in
Avatar of jagguy
jagguyFlag for Australia

asked on

master file label

In asp.net master page app can I display a label from the master page that reflects the page I am on?
For example I want a variable in the master page to display some instructions in the master page area depending on what webpage I am on.

Avatar of devlab2012
devlab2012
Flag of India image

Suppose you have a label "lblMessage" on the master page, then on your content page you can change the text of this label with following statement:

Label lbl1 = (Label)Page.Master.FindControl("lblMessage");
lbl1.Text = "Text based upon content page";
ASKER CERTIFIED SOLUTION
Avatar of HainKurt
HainKurt
Flag of Canada image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
In VB.NET:

Page.Master.FindControl("lblMessage").Text = "Text based upon content page"