473,659 Members | 3,494 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

referring instantiating page

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.

Aug 24 '07 #1
2 1731
How about something like this:

MyClass mc = new MyClass(Page)
-- where _page is a private field of type Page inside MyClass.
Now you have access to Page from within MyClass.
-- Peter
Recursion: see Recursion
site: http://www.eggheadcafe.com
unBlog: http://petesbloggerama.blogspot.com
BlogMetaFinder: http://www.blogmetafinder.com

"Aamir Ghanchi" wrote:
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.

Aug 24 '07 #2
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.

Aug 25 '07 #3

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

Similar topics

3
9887
by: Jenkins | last post by:
I have a page with frames. The left frame is a list of urls. The main frame is loaded based on the url that was clicked in the left frame. Is there a way for the main frame to tell which url was clicked in the left frame? I'd like to avoid having to use a name/value pair in the links in the left frame, which I'm currently doing. I'd prefer to use something similar to $_server('REFERER') but I can't find anything that would list the...
3
4429
by: Steve Macleod | last post by:
Hi, I am using the following code to initialise a session, depending on whether-or-not the users' log in attempt has been successful. if ($session_ok == "TRUE") { //open the session session_start(); //assign user details to session $_SESSION = $user_id; $_SESSION = $user_pass;
3
2218
by: George | last post by:
VS.NET 2002\Web\VB I am trying to get the referring URL for one of my pages using this: Request.UrlReferrer.ToString Page 1 has a link to Page 2. I click on the link in Page 1, and go to Page 2. Page 2 is where I am trying to get the referring URL. However, instead of getting the URL of Page 1 (the referring page), I get the URL of the Page 2 (the current page), instead.
2
2328
by: buran | last post by:
Dear ASP.NET Programmers, I want to store the referring page of an .aspx page so that I can redirect the user back to the referring page if needed. I am using the following code snippet but receiving Object reference not set to an instance of an object error. The code is as follows: If Not Page.IsPostBack Then Viewstate("ReferrerURL") = Request.UrlReferrer.ToString() LoadData()
3
3124
by: Dan Sikorsky | last post by:
How can I get the Querystring passed to the Referring Page from its referrer? I don't want the querystring coming to my current page. I want the querystring that came to the referring page, so that I can check for the existance of a parameter value in that previous querystring.
1
2200
by: Marja Ribbers-de Vroed | last post by:
I've been provided with a custom ActiveX DLL (written in C++) that reads a certiifcate to generate a signature for a passed XML string, and I'm having trouble instantiating it. The DLL is registered succesfully on my computer and I've explicitly granted IUSR_<machinename> to use it. The DLL comes with a testtool (written in Visual Basic) which instantiates the object like this: Dim loCertCryptCOM As New CCOMCRYPTLib.CCrypt As you can...
5
3222
by: Christina | last post by:
I can't seem to find any reference for grabbing the title of the referring page, which I want to use for creating a link. i.e. document.write ("Our thanks to <a href='"+document.referrer+"'>" +referring page title +"<a>"). I have looked into using location.history also. This is probably a standard thing, but through all the forums and searches I only find a mishmosh of things referring to using frames, a different scripting language, etc....
2
2290
by: paladin | last post by:
We have a strange situation where some of the referring URL's are missing from our log files. This is on .NET application on IIS 6.0. Here is what is happening: Page a.aspx has a form that POST's to a.aspx. If there are errors with the form information, then a.aspx is displayed with an error message to the user. If all the information is correct then it is redirected (response.redirect) - GET to page b.aspx. In this GET to b.aspx (and
4
2402
by: CG | last post by:
Hi I need to implement some low level security that locks a certain page if the user does come from a particular link (which is hosted on another domain). I've considered using HTTP_REFERER variable but seems this is a little shaky as it is not alway set. Does anyone have a solution that would allow me to restrict. I figure I can't use a session as it is linked from another domain - same with cookies.
0
8428
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8337
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8851
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
7359
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6181
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5650
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4335
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2754
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1978
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.