access to page from user control

  • Thread starter Thread starter Alex Wagner
  • Start date Start date
A

Alex Wagner

I've been trying to gain access to the container page from within a user
control. Case in point:

From within the user control I need to call a method in the business layer
that needs a reference to the aspx page. The method signature looks like:

public static void MyMethod(System.Web.UI.WebControls.WebControl
MyWebControl, System.Web.UI.Page MyPage, string SomeOtherVariable)

what am I supposed to pass in for the MyPage parameter??

Thanks.
 
I love newsgroups... after posting I always find my own answers... ;)

Here's what I did:

instead of calling the method from the aspx page like
MyMethod(txtMyControl, this, "someValue");
I call it like this from the user control:
MyMethod(txtMyControl, (System.Web.UI.Page)this.Parent.Page,
"someValue");

voila.
 
Hello Alex,
public static void MyMethod(System.Web.UI.WebControls.WebControl
MyWebControl, System.Web.UI.Page MyPage, string SomeOtherVariable)

what am I supposed to pass in for the MyPage parameter??

this.Page
 
Back
Top