473,385 Members | 1,344 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

MasterPages and content pages

Question:

Is there a way of manipulating a master page element from a content
page? For example, if I have lblStatus on the masterpage and I call
anypage.aspx, can I set lblStatus from anypage?

Thanks,

Jul 31 '06 #1
3 906
Yes. If you put a line

<%@ MasterType virtualpath="~/myMasterPage.master" %>

to the .aspx file of the content, you will be abble to access all public
members of the master as this.Master.myProperty

--
Eliyahu Goldin,
Software Developer & Consultant
Microsoft MVP [ASP.NET]

<sa********@gmail.comwrote in message
news:11*********************@s13g2000cwa.googlegro ups.com...
Question:

Is there a way of manipulating a master page element from a content
page? For example, if I have lblStatus on the masterpage and I call
anypage.aspx, can I set lblStatus from anypage?

Thanks,

Jul 31 '06 #2
Hi salportaro,

Add this to your ASPX file:
<%@ MasterType VirtualPath="~/path/to/file.master" %>

Then, in your code, you can use:

this.Master.[whatever]

Ray at work

<sa********@gmail.comwrote in message
news:11*********************@s13g2000cwa.googlegro ups.com...
Question:

Is there a way of manipulating a master page element from a content
page? For example, if I have lblStatus on the masterpage and I call
anypage.aspx, can I set lblStatus from anypage?

Thanks,

Jul 31 '06 #3
Dim lbl As Label
lbl = CType(Master.FindControl("Label4"), Label)
lbl.Text = "whatever"
<sa********@gmail.comwrote in message
news:11*********************@s13g2000cwa.googlegro ups.com...
Question:

Is there a way of manipulating a master page element from a content
page? For example, if I have lblStatus on the masterpage and I call
anypage.aspx, can I set lblStatus from anypage?

Thanks,

Jul 31 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Kenneth Keeley | last post by:
Hi, I have a Masterpage that controls the basic layout of the pages displayed on a web site. The masterpage also uses some variables. I would like to be able to access some of these variables from...
4
by: Jeff Lynch | last post by:
I need to call a class on every web page in a site. In ASP.NET 1.1 I would call this class before the Page_Load event in each web page's code-behind file since it needs to run before the web page...
2
by: iturner100 | last post by:
Hi, I've been struggling with this one for a couple of hours without much joy. Basically, I've got a set of nested masterpages (3 as it happens). I'm dynamically generating a new page in code...
0
by: Learner | last post by:
Hello, I have one MasterPage (it has Header and Side lay out on it) and it has 3 component placeholders. Out of which the side one for the links to navigate through the site, the Header place is...
2
by: Sean | last post by:
We have a Master page problem that comes around time and time at work and it’s a problem that has been confirmed by other developers on the project I have been on. Additionally I have had the...
3
by: j-in-uk | last post by:
I have 3 pages Site.master, Album.aspx and ContinentsMenu.ascx. Continents is a usercontrol placed in Albums. In Album.aspx.cs I need to access a property from the Continents usercontrol and is...
9
by: RBM007 | last post by:
Hello, I have created some pages in the (old) Atlas pages and migrated to AJAX version. After the update I noticed that any page containing ASP.NET AJAX won't compile anymore. Even if the same...
6
by: =?Utf-8?B?U3RlcGhlbiBIYXRmaWVsZA==?= | last post by:
I have two masterpages in a web application. One is used for the login and logout pages. The other is used for all other pages in the application. The difference between the two masterpages is...
8
by: Randy Smith | last post by:
Hi, I now need to add MasterPages to a number of existing forms, but when I add the code for MasterPage, the MasterPage does NOT appear when it runs. Any thoughts? TIA, Randy Smith
8
by: Mort Strom | last post by:
Right now the header of my master page contains all of the CSS styles for all of the pages that might be loaded in my ContentPlaceHolder. The problem is that my <styletag is getting too large to...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.