Reference ASP.Net Page from a Master Page

G

Guest

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
 
M

Mark Rae

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...
 
G

Guest

Mark Rae said:
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 )
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,968
Messages
2,570,152
Members
46,698
Latest member
LydiaHalle

Latest Threads

Top