473,406 Members | 2,867 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,406 software developers and data experts.

Reference ASP.Net Page from a Master Page

I have some code in a basePage class
public class PageBase : Page {}

that I would like to access from a Master Page.

On the Master Page I would like to code something like
this.Page.thePropertyIwant
or
this.Parent.thePropertyIwant
or
this.PageBase.thePropertyIwant
but I cant find the correct syntax

Any ideas?
Charlie

Dec 10 '06 #1
2 1068
"Charlie" <Ch*****@discussions.microsoft.comwrote in message
news:B5**********************************@microsof t.com...
>I have some code in a basePage class
public class PageBase : Page {}

that I would like to access from a Master Page.

On the Master Page I would like to code something like
this.Page.thePropertyIwant
or
this.Parent.thePropertyIwant
or
this.PageBase.thePropertyIwant
but I cant find the correct syntax

Any ideas?
The code behind an aspx page is just a class like any other class...

However, the code behind an aspx page is really intended solely for that
page... If you have code in an aspx page's partial class which you need
outside that page, you should really consider moving it into a separate
class...
Dec 11 '06 #2


"Mark Rae" wrote:
"Charlie" <Ch*****@discussions.microsoft.comwrote in message
news:B5**********************************@microsof t.com...
I have some code in a basePage class
public class PageBase : Page {}

that I would like to access from a Master Page.

On the Master Page I would like to code something like
this.Page.thePropertyIwant
or
this.Parent.thePropertyIwant
or
this.PageBase.thePropertyIwant
but I cant find the correct syntax

Any ideas?

The code behind an aspx page is just a class like any other class...

However, the code behind an aspx page is really intended solely for that
page... If you have code in an aspx page's partial class which you need
outside that page, you should really consider moving it into a separate
class...

Actually I agree!

The code in question is to do with the user. Ideally I would create a user
object (probably at Application_authenticate request) and store this in the
session
and then I would be able to refer to it when nd where ever

the answer to my post though is
on the master page.cs have
if ( ((PageBase)this.Page).thePropertyIwant )

Dec 11 '06 #3

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

Similar topics

0
by: Abraham Andres Luna | last post by:
i have a master page: <%@ Master Language="C#" %> <html> <head> <title>CRM - RDK Truck Sales & Service</title> </head> <body> <form runat="server"> <asp:contentplaceholder...
8
by: PJ | last post by:
How can I get a reference to the master page class? It is defined as a partial class, but I cannot seem to type a variable to the name of the partial class? The compiler continually shows "The...
0
by: John Holmes | last post by:
I have a website that consists of numerous ASP.NET applications (each referred to as a website in VS 2005) which I'd like to have share a master page. My directory structure on the website is like...
13
by: Michael | last post by:
I have setup a public variable in the Master Page "code-behind-file". Now I would like to set that value from the UserControl, but I can't seem to find a way to do this. Does anyone have any ideas?...
3
by: Managed Code | last post by:
I have a BasePage class that derives from System.Web.UI.Page. All of my content pages derive from this. The derived page classes use the following MasterType declaration that follows to reference...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.