referring instantiating page

  • Thread starter Thread starter Aamir Ghanchi
  • Start date Start date
A

Aamir Ghanchi

Hi,

would I refer the aspx page from the class which has been instantiated
in that aspx page.

say I have Default.aspx.
In the code page Default.aspx.cs I instantiate a class as
MyClass mc = new MyClass()

and in the constructor or any other method of MyClass I need to refer
the page Default.aspx and its properties/methods. How do I do it. I am
aware of the PreviousPage property which is meant for cross-page
posting.

Any response will be appreciated.
Thanks in advance.
 
You may define an interface with signatures of properties and methods
which you need to call from class, inherit your page from that
interface, and pass page instance to class as that interface type and
then call those properties or methods in class.
 
Back
Top