Reference ASP.Net Page from a Master Page

  • Thread starter Thread starter Guest
  • Start date Start date
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
 
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...
 
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 )
 
Back
Top