?
Solved

master file label

Posted on 2011-03-23
3
Medium Priority
?
408 Views
Last Modified: 2012-05-11
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.

0
Comment
Question by:jagguy
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 13

Expert Comment

by:devlab2012
ID: 35204215
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";
0
 
LVL 59

Accepted Solution

by:
HainKurt earned 2000 total points
ID: 35204221
in master add a public property

public pageName as string=""

then on any page using master page

me.master.pagename = "User Control Page"
' you may need to cast your master to masterpage type to use pagename property

and on master page_render event use this to set a label on master...
or create a property and when set, change the label.text to this value

Public Property PageName() As Integer
Get
  Return lblPageName.Text
End Get
Set(ByVal Value As Integer)
  lblPageName.Text = value
End Set
End Property
0
 
LVL 13

Expert Comment

by:devlab2012
ID: 35204227
In VB.NET:

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

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Today is the age of broadband.  More and more people are going this route determined to experience the web and it’s multitude of services as quickly and painlessly as possible. Coupled with the move to broadband, people are experiencing the web via …
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…

719 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question