473,320 Members | 1,872 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

access to page from user control

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.
Nov 18 '05 #1
2 1606
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.

"Alex Wagner" <gb*****@hot-nospam-mail.com> wrote in message
news:uE**************@TK2MSFTNGP12.phx.gbl...
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.

Nov 18 '05 #2
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

--
Matt Berther
http://www.mattberther.com
Nov 18 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Ben R. | last post by:
Hello, I've got a text-based .inc file that I'm using for my asp.net site's header. I thought about a user control, but if possible, I'd like to avoid it for simplicity's sake. In the main page,...
2
by: paul meaney | last post by:
All, myself and another developer have been staring blankly at a screen for the past 48 hours and are wondering just what stunningly obvious thing we are missing. We are trying to load up 2...
3
by: qwerty | last post by:
I have two User controls in a page. Them ID-propertys are example UC1 and UC2. In code behind file they are declared: Public UC1 As UC1 Public UC1 As UC1 From the page I can call them with...
2
by: Jon Hyland | last post by:
This might be a dumb question, but what is the best way for one instance of a user control to access properties of an instance of another user control? For example, let's say I have an instance...
9
by: Anders K. Jacobsen [DK] | last post by:
Hi I have this that adds some usercontrol (UCTodays.ascx) to a placeholder foreach(A a in B){ UCTodays ucline = (UCTodays )LoadControl("UCTodays.ascx");...
5
by: Steve Richter | last post by:
In my user control I want to read the ViewState dictionary of the Parent control. But this sensible idea is not permitted by the compiler: Compiler Error Message: CS1540: Cannot access...
5
by: c676228 | last post by:
Hi, I guess I am confused. In aspx script, I mean (you won't use Codebehind="enrollinfo.aspx.vb", but mix code with html and code together) You can access user control's property directly. Since I...
3
by: ivanpais | last post by:
Hi, I have a Web User Control, Lets say "Foo.ascx", that contains a button "btnFoo". I have a Master Page "Bar.master", that has a label "lblBar". This label is exposed by a public property...
1
by: schneider | last post by:
Is it possible to get access to the local resource (App_LocalResources) of an aspx page from within a user control located somewhere else? I have created a user control which I want to add to a...
7
by: Andy B | last post by:
I have a class I am creating for data access. I need to access controls from inside the class that are on a particular page. How do I do this? or is creating an instance of the page class and using...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.