Hi all,
I try to reference several pages from a class (ideally located in a class
library). But no namespace is available to do this.
Does anybody have an idea how to do this?
Thanks for your help,
Ugo 7 1755
Ugo,
You may want to pass the references to the pages to your class explicitly.
--
Eliyahu Goldin,
Software Developer & Consultant
Microsoft MVP [ASP.NET]
"Ugo Van Noorbeeck" <Va**********@guidance.bewrote in message
news:Oh**************@TK2MSFTNGP04.phx.gbl...
Hi all,
I try to reference several pages from a class (ideally located in a class
library). But no namespace is available to do this.
Does anybody have an idea how to do this?
Thanks for your help,
Ugo
Hi all,
>
I try to reference several pages from a class (ideally located in a class
library). But no namespace is available to do this.
Does anybody have an idea how to do this?
Thanks for your help,
Ugo
What are you trying to do? You can't access them as you can with
winform-windows, where you can read values from hidden windows.
With webforms (asp.net) all page-values are gone as soon as the request
has finished processing.
You *can* get at the current Request or Session, using
System.Web.HttpContext.Current.Request (or .Session).
You will need a project-reference to System.Web.dll for this.
Hans Kesting
Hello,
In fact I want to be able to alter my page(s) with a "main controller" (the
class in the class library). I have several pages that differs only by one
textbox or so. And instead of creating new pages, I made a few "pattern
pages" in which I only hide/modify some controls depending on the page to
load. (I don't think Master page can help).
So, in the page_load (or just after) I call the method in the controller
class to make the adjustments. I pass the calling page as an argument but in
the code of the method this is a generic System.Web.UI.Page and I need to
cast it in the right "pattern page" type to access the controls.
There is where I need to reference the pages.
I hope it is a bit clearer.
Many thaks,
Ugo
"Hans Kesting" <ne***********@spamgourmet.comwrote in message
news:mn***********************@spamgourmet.com...
>Hi all,
I try to reference several pages from a class (ideally located in a class library). But no namespace is available to do this.
Does anybody have an idea how to do this?
Thanks for your help,
Ugo
What are you trying to do? You can't access them as you can with
winform-windows, where you can read values from hidden windows.
With webforms (asp.net) all page-values are gone as soon as the request
has finished processing.
You *can* get at the current Request or Session, using
System.Web.HttpContext.Current.Request (or .Session).
You will need a project-reference to System.Web.dll for this.
Hans Kesting
Ugo,
You can always get the type name from the passed "page" parameter as
page.GetType().ToString();
--
Eliyahu Goldin,
Software Developer & Consultant
Microsoft MVP [ASP.NET]
"Ugo Van Noorbeeck" <Va**********@guidance.bewrote in message
news:uV**************@TK2MSFTNGP05.phx.gbl...
Hello,
In fact I want to be able to alter my page(s) with a "main controller"
(the class in the class library). I have several pages that differs only
by one textbox or so. And instead of creating new pages, I made a few
"pattern pages" in which I only hide/modify some controls depending on the
page to load. (I don't think Master page can help).
So, in the page_load (or just after) I call the method in the controller
class to make the adjustments. I pass the calling page as an argument but
in the code of the method this is a generic System.Web.UI.Page and I need
to cast it in the right "pattern page" type to access the controls.
There is where I need to reference the pages.
I hope it is a bit clearer.
Many thaks,
Ugo
"Hans Kesting" <ne***********@spamgourmet.comwrote in message
news:mn***********************@spamgourmet.com...
>>Hi all,
I try to reference several pages from a class (ideally located in a class library). But no namespace is available to do this.
Does anybody have an idea how to do this?
Thanks for your help,
Ugo
What are you trying to do? You can't access them as you can with winform-windows, where you can read values from hidden windows. With webforms (asp.net) all page-values are gone as soon as the request has finished processing.
You *can* get at the current Request or Session, using System.Web.HttpContext.Current.Request (or .Session). You will need a project-reference to System.Web.dll for this.
Hans Kesting
Yes, that's right but after, I have to dynamically cast the page into this
retrieved type. How can I do that? And how can the compiler let me call,
let's say: textbox1.enbled = false; onto a type that isn't known at compile
time?
One precision, I work in C#. If it is possible in VB that would be terrific!
Ugo
"Eliyahu Goldin" <re*************@monarchmed.comwrote in message
news:Oh**************@TK2MSFTNGP03.phx.gbl...
Ugo,
You can always get the type name from the passed "page" parameter as
page.GetType().ToString();
--
Eliyahu Goldin,
Software Developer & Consultant
Microsoft MVP [ASP.NET]
"Ugo Van Noorbeeck" <Va**********@guidance.bewrote in message
news:uV**************@TK2MSFTNGP05.phx.gbl...
>Hello,
In fact I want to be able to alter my page(s) with a "main controller" (the class in the class library). I have several pages that differs only by one textbox or so. And instead of creating new pages, I made a few "pattern pages" in which I only hide/modify some controls depending on the page to load. (I don't think Master page can help). So, in the page_load (or just after) I call the method in the controller class to make the adjustments. I pass the calling page as an argument but in the code of the method this is a generic System.Web.UI.Page and I need to cast it in the right "pattern page" type to access the controls. There is where I need to reference the pages.
I hope it is a bit clearer.
Many thaks,
Ugo "Hans Kesting" <ne***********@spamgourmet.comwrote in message news:mn***********************@spamgourmet.com. ..
>>>Hi all,
I try to reference several pages from a class (ideally located in a class library). But no namespace is available to do this.
Does anybody have an idea how to do this?
Thanks for your help,
Ugo
What are you trying to do? You can't access them as you can with winform-windows, where you can read values from hidden windows. With webforms (asp.net) all page-values are gone as soon as the request has finished processing.
You *can* get at the current Request or Session, using System.Web.HttpContext.Current.Request (or .Session). You will need a project-reference to System.Web.dll for this.
Hans Kesting
Yes, that's right but after, I have to dynamically cast the page into this
retrieved type. How can I do that? And how can the compiler let me call,
let's say: textbox1.enbled = false; onto a type that isn't known at compile
time?
One precision, I work in C#. If it is possible in VB that would be terrific!
Ugo
The Page has a "FindControl" method that you can use to find some
control by name. You can use this to see if there is a textbox named
"TextBox1". If so, cast the control that's found to TextBox and set
it's Visible property (or whatever you want to do with it).
One important note: this FindControl only finds immediate children (at
least in 1.1), so you might want to wrap this in a method that searches
the entire control-tree recursively.
Hans Kesting
>
"Eliyahu Goldin" <re*************@monarchmed.comwrote in message
news:Oh**************@TK2MSFTNGP03.phx.gbl...
>Ugo,
You can always get the type name from the passed "page" parameter as
page.GetType().ToString(); -- Eliyahu Goldin, Software Developer & Consultant Microsoft MVP [ASP.NET]
"Ugo Van Noorbeeck" <Va**********@guidance.bewrote in message news:uV**************@TK2MSFTNGP05.phx.gbl...
>>Hello,
In fact I want to be able to alter my page(s) with a "main controller" (the class in the class library). I have several pages that differs only by one textbox or so. And instead of creating new pages, I made a few "pattern pages" in which I only hide/modify some controls depending on the page to load. (I don't think Master page can help). So, in the page_load (or just after) I call the method in the controller class to make the adjustments. I pass the calling page as an argument but in the code of the method this is a generic System.Web.UI.Page and I need to cast it in the right "pattern page" type to access the controls. There is where I need to reference the pages.
I hope it is a bit clearer.
Many thaks,
Ugo
"Hans Kesting" <ne***********@spamgourmet.comwrote in message news:mn***********************@spamgourmet.com.. . >
What are you trying to do? You can't access them as you can with winform-windows, where you can read values from hidden windows. With webforms (asp.net) all page-values are gone as soon as the request has finished processing.
You *can* get at the current Request or Session, using System.Web.HttpContext.Current.Request (or .Session). You will need a project-reference to System.Web.dll for this.
Hans Kesting
Hello,
This work for me!
Many thanks,
Regards,
Ugo
"Hans Kesting" <ne***********@spamgourmet.comwrote in message
news:mn***********************@spamgourmet.com...
>Yes, that's right but after, I have to dynamically cast the page into this retrieved type. How can I do that? And how can the compiler let me call, let's say: textbox1.enbled = false; onto a type that isn't known at compile time?
One precision, I work in C#. If it is possible in VB that would be terrific!
Ugo
The Page has a "FindControl" method that you can use to find some control
by name. You can use this to see if there is a textbox named "TextBox1".
If so, cast the control that's found to TextBox and set it's Visible
property (or whatever you want to do with it).
One important note: this FindControl only finds immediate children (at
least in 1.1), so you might want to wrap this in a method that searches
the entire control-tree recursively.
Hans Kesting
>>
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Paul |
last post by:
Title: What are the Consequences of Aspx page separate from app DLL
Hi JL;
I am working on a big asp.net application.
When we migrate the dll (or dlls) to the production server, all users
who are...
|
by: BH |
last post by:
I'm looking at the source code of the ASP.NET forum sample application. It
has the "code-behind" classes compiled into a separate DLL, totally
separated from the aspx/ascx files. Adding the class...
|
by: martin |
last post by:
Hi,
I am a web page and a web user control. My web user control is placed in my
web page using the following directive
<%@ Register TagPrefix="uc1" TagName="Header"...
|
by: TWEB |
last post by:
I think I may have an IIS / ASP.Net Configuration issue that I need some
guidance with resolving.
Here's the problem:
a) I have a .stm file.
b) I referenc a .aspx file on this .stm file using a...
|
by: John Rivers |
last post by:
Hello,
What good reason there is for not allowing methods in ASPX pages I
can't imagine, but here is how to get around that limitation:
(START)
<body MS_POSITIONING="FlowLayout">
<form...
|
by: hgnis_ppc |
last post by:
In one of my recent projects , I am planning to split the work as a
core asp.net application and 3 separate modules (asp.net applications)
that provide other functionalities.
I want to be able...
|
by: steve_barker333 |
last post by:
Hi guys!
I keep getting the following error reported by VS 2005 in my ASP.NET
2.0 web project:
"The type or namespace name 'MainPages_XXX' could not be found (are you
missing a using...
|
by: Max2006 |
last post by:
Hi,
Is there any way to break a web application into separated web projects, so
we can re-use pages\?
I am trying to put aspx pages and/or ascx pages in separated web projects,
|
by: =?Utf-8?B?SmFtZXMgUGFnZQ==?= |
last post by:
Hi all
I have a user control - mycontrol.ascx with various controls within it.
mycontrol.ascx is utilised in myPage.aspx
I have a class (class1) to carry out various functions, subs etc.
How...
|
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...
|
by: ryjfgjl |
last post by:
ExcelToDatabase: batch import excel into database automatically...
|
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...
|
by: Vimpel783 |
last post by:
Hello!
Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
|
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)...
|
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...
|
by: Defcon1945 |
last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
|
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....
|
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...
| |