Hello,
I'm doing a cross page post, and want to pick up information from the
previous page. The problem is that the previous page contains a user
control that is loaded into a Placeholder at run time. I can't seem to
get at the Placeholder from the target page.
The first page has an empty placeholder, and the code-behind loads a
user control dynamically and adds it to the placeholder. The user
control grabs an ID from the querystring (hidden by using URL rewriting)
and adds HTML to the control itself.
On (cross page) posting, the target page does the following...
if (PreviousPage != null) {
PlaceHolder plcProductDetails =
(PlaceHolder)PreviousPage.FindControl("plcProductD etails"); }
but this always comes out null. Any ideas? Thanks for any help.
--
Alan Silver
(anything added below this line is nothing to do with me) 4 3297
In article <Dc**************@nospamthankyou.spam>, Alan Silver
<al*********@nospam.thanx.invalid> writes Hello,
I'm doing a cross page post, and want to pick up information from the previous page. The problem is that the previous page contains a user control that is loaded into a Placeholder at run time. I can't seem to get at the Placeholder from the target page.
The first page has an empty placeholder, and the code-behind loads a user control dynamically and adds it to the placeholder. The user control grabs an ID from the querystring (hidden by using URL rewriting) and adds HTML to the control itself.
On (cross page) posting, the target page does the following...
if (PreviousPage != null) { PlaceHolder plcProductDetails = (PlaceHolder)PreviousPage.FindControl("plcProduct Details"); }
but this always comes out null. Any ideas? Thanks for any help.
It occurred to me after posting that the placeholder is inside a content
control as this is on a master page. Presumably I have to find a way of
getting the content control, then getting the placeholder from within
it, then getting the user control from within that, then getting the
properties I want from the user control.
Is there a simple way to do this, or do I have to work my way down, and
hope that I don't change the names or positions of any of these controls
in the future?
TIA
--
Alan Silver
(anything added below this line is nothing to do with me)
In article <me**************@nospamthankyou.spam>, Alan Silver
<al*********@nospam.thanx.invalid> writes Is there a simple way to do this, or do I have to work my way down, and hope that I don't change the names or positions of any of these controls in the future?
OK, having played around with this, I have realised that trying to work
my way down is going to be impossible. I don't know the IDs of the
controls as each container changes the IDs of its child controls, and
due to the way master pages, child pages, content holders, place
holders, custom controls, etc are set up, the hierarchy becomes very
complex. The slightest change in the HTML would throw the entire thing
out, causing me to have to rewrite the code all over again.
So, is there some direct way of getting at a control in the custom
control? I can't believe MS added this great feature, and didn't give
some reliable way of getting at controls in the previous page.
Any help mucho appreciated.
--
Alan Silver
(anything added below this line is nothing to do with me)
Alan:
I wrote an article on cross page postbacks where I have the page
implment an interface and expose a property with the paramter (or the
control) I need to get to. It makes the job pretty simple: http://www.odetocode.com/Articles/421.aspx
--
Scott http://www.OdeToCode.com/blogs/scott/
On Mon, 27 Feb 2006 22:57:46 +0000, Alan Silver
<al*********@nospam.thanx.invalid> wrote: In article <me**************@nospamthankyou.spam>, Alan Silver <al*********@nospam.thanx.invalid> writesIs there a simple way to do this, or do I have to work my way down, and hope that I don't change the names or positions of any of these controls in the future?
OK, having played around with this, I have realised that trying to work my way down is going to be impossible. I don't know the IDs of the controls as each container changes the IDs of its child controls, and due to the way master pages, child pages, content holders, place holders, custom controls, etc are set up, the hierarchy becomes very complex. The slightest change in the HTML would throw the entire thing out, causing me to have to rewrite the code all over again.
So, is there some direct way of getting at a control in the custom control? I can't believe MS added this great feature, and didn't give some reliable way of getting at controls in the previous page.
Any help mucho appreciated.
In article <ak********************************@4ax.com>, Scott Allen
<sc***@nospam.odetocode.com> writes Alan:
I wrote an article on cross page postbacks where I have the page implment an interface and expose a property with the paramter (or the control) I need to get to. It makes the job pretty simple: http://www.odetocode.com/Articles/421.aspx
Hi Scott,
Thanks for the reply. I already saw that article, but unfortunately it
didn't help in my situation. The original page takes a querystring
parameter and uses that to load the product info from a database. When
the target page creates the PreviousPage object, it doesn't give it the
querystring parameter, so the PreviousPage object contains the info that
would be shown when an invalid product ID is passed. Obviously this
doesn't give me the info I want.
I actually managed to solve this part of the problem in a much simpler
way. It occurred to me to dump the contents of Request.Form into a
Literal to see what was in there. To my surprise, the controls I wanted
were shown with their original names. This made picking up the info
really easy!!
I'm now trying to do a similar thing where the original page shows a
list of products in a repeater, with each product having its own "buy"
button. That doesn't seem to be working as easily!! Any further
suggestions welcome.
-- Scott http://www.OdeToCode.com/blogs/scott/
On Mon, 27 Feb 2006 22:57:46 +0000, Alan Silver <al*********@nospam.thanx.invalid> wrote:
In article <me**************@nospamthankyou.spam>, Alan Silver <al*********@nospam.thanx.invalid> writesIs there a simple way to do this, or do I have to work my way down, and hope that I don't change the names or positions of any of these controls in the future?
OK, having played around with this, I have realised that trying to work my way down is going to be impossible. I don't know the IDs of the controls as each container changes the IDs of its child controls, and due to the way master pages, child pages, content holders, place holders, custom controls, etc are set up, the hierarchy becomes very complex. The slightest change in the HTML would throw the entire thing out, causing me to have to rewrite the code all over again.
So, is there some direct way of getting at a control in the custom control? I can't believe MS added this great feature, and didn't give some reliable way of getting at controls in the previous page.
Any help mucho appreciated.
--
Alan Silver
(anything added below this line is nothing to do with me) This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Kel Good |
last post by:
I'm wondering if the PreviousPage property is only populated when a page is
cross posted on the same server, or will this work in a web farm situation.
Thanks.
Kel
|
by: michael.neel |
last post by:
Here is the setup:
I have an SQL driven sitemap provider - when the user clicks on a
database generated link - /Site/DBPages/Article1.aspx - a handler does
a Server.Transfer -...
|
by: PeterKellner |
last post by:
Is there something extra I need to do to make intellisense work when
referencing a page class? Here is my working Page_Load from a aspx page.
sourcePage does not get it's members listed with...
|
by: Jim McGivney |
last post by:
I am trying to use the PreviousPage feature in asp.net 2.0
On the source (previous page) I have:
protected void Page_Load(object sender, EventArgs e)
{
..... Code to populate ArrMH //ArrMH is...
|
by: Jim McGivney |
last post by:
I have been trying to get the values from a previous page on my target page.
I have followed the help article:...
| |
by: Bryce |
last post by:
I have a search page that submits to a search results page. I have set
the search results page to be authenticated, so when the user first
tries to search, it redirects them to a login screen. When...
|
by: jeroen.bolle |
last post by:
I'm trying to pass variables between pages using the post method. I
have access to the the page where I've posted my form, but all the
objects are empty...
An extract of the code:
If Not...
|
by: John Kotuby |
last post by:
Hi all,
After more than a year programming with ASP.NET 2.0 and VB I am still
finding it difficult to leave some habits from classic ASP behind. this is
particularly true with cross-page posting....
|
by: rjvrnjn |
last post by:
I'm trying to pass a variable value from one page to another. Of all the ways that are available, I like the PreviousPage.FindControl() one as it lets me access the previous page controls and get the...
|
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: 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,...
| |
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...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
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,...
|
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...
|
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...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
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 ...
| |