Solved

master file label

Posted on 2011-03-23
3
405 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 53

Accepted Solution

by:
Huseyin KAHRAMAN earned 500 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

Creating Instructional Tutorials  

For Any Use & On Any Platform

Contextual Guidance at the moment of need helps your employees/users adopt software o& achieve even the most complex tasks instantly. Boost knowledge retention, software adoption & employee engagement with easy solution.

Question has a verified solution.

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

I recently went through the process of creating a Calendar Control of events with the basis of using a database to keep track of the dates that are selectable, one requirement was to have the selected date pop-up in a simple lightbox.  At first this…
Problem Hi all,    While many today have fast Internet connection, there are many still who do not, or are connecting through devices with a slower connect, so light web pages and fast load times are still popular.    If your ASP.NET page …
Are you ready to implement Active Directory best practices without reading 300+ pages? You're in luck. In this webinar hosted by Skyport Systems, you gain insight into Microsoft's latest comprehensive guide, with tips on the best and easiest way…
This video shows how to use Hyena, from SystemTools Software, to update 100 user accounts from an external text file. View in 1080p for best video quality.

739 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