access to page from user control

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

Alex Wagner

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

Matt Berther

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
 

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,743
Messages
2,569,478
Members
44,898
Latest member
BlairH7607

Latest Threads

Top