473,382 Members | 1,225 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,382 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 1609
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: 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...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.