473,320 Members | 1,861 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.

Getting control ID from Web Parts Zone on Crosspage postback

I have an ASPX page that needs to read in form values (txtbox,
dropdownlists, etc) from a custom control that redirects execution by
crosspage postback. Here is the how it is being redirected:

<asp:Button ID="btnViewReport" runat="server" Text="View Report"
PostBackUrl="~/Viewer.aspx" />

The custom control is sitting in a Web Part Zone Declarative Catalog:

<asp:CatalogZone ID="CatalogZone1" runat="server" >
<ZoneTemplate>
<asp:PageCatalogPart ID="PageCatalogPart1"
runat="server" />
<asp:DeclarativeCatalogPart
ID="DeclarativeCatalogPar1" runat="server">
<WebPartsTemplate>
<PARMS:Parameters ID="ucParms"
runat="server" title="ABC" />
</WebPartsTemplate>
</asp:DeclarativeCatalogPart>
</ZoneTemplate>
</asp:CatalogZone>

The ASPX page that is redirected to has code that tries to retrieve the
ID of the control so that it can access and find the values contained
in the custom control's form fields. The problem is that since this is
a Web Part, we may not know which zone it is located in and must thus
loop through all the zones in the web part manager, as such:

WebPartManager wpm = WebPartManager.GetCurrentWebPartManager(page);
if (wpm == null)
throw new Exception(msgNoControlID); //
msgNoControlIID is defined earlier

WebPartZoneBase wz = null; // wpm.Zones[zoneID];

for (int i = 0; i < wpm.Zones.Count; i++)
{
wz = wpm.Zones[i];
for (int j = 0; j < wz.WebParts.Count; j++)
{
for (int k = 0; k < wz.WebParts[j].Controls.Count;
k++)
{
if (wz.WebParts[j].Controls[k].ID == controlID)
return
wz.WebParts[j].Controls[k].UniqueID.ToString();
}
}
}

throw new Exception("Cannot find Control " + controlID + "
in Zone " + zoneID);

These sets of code (and the code I haven't shown) all works if the
custom control is embedded somewhere as a Web Part Zone instead of a
Declarative Catalog in a Catalog Zone. But once it's only in the
Declarative Catalog, the ASPX page fails to find the custom control's
ID on cross page postback.

My question is this, is there a solution that meets my needs for having
my custom control redirect execution to another ASPX page where it can
read the form values from it without using Session variables or reading
from querystring in the URL?

Sep 25 '06 #1
0 1660

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

Similar topics

2
by: Duwayne | last post by:
I am having lots of trouble with one of my user controls (ascx) not automatically loading postback data. An image on the aspx page starts the postback and the parent has no problem loading it's own...
1
by: Lamont Adams | last post by:
Hi all, I've created numerous custom controls of varying complexity, but I've been on this problem for a day and a half, and I can't figure this mystery out. I hope one of you kind folks can...
5
by: Michael Herman \(Parallelspace\) | last post by:
1. What are some compelling solutions for using Master/Content pages with Web Pages? 2. If a content area has a web part zone with web parts, what is the user experience like when "editting" the...
0
by: Vince Varallo | last post by:
Is there anyway to prevent a postback event when a web part is moved into a different zone? I am using the MSNBC weather web part and it fires a java script which is causing an error because the...
0
by: Vince Varallo | last post by:
Is there anyway to prevent a postback event when a web part is moved into a different zone? I am using the MSNBC weather web part and it fires a java script which is causing an error because the...
0
by: Vince Varallo | last post by:
Is there anyway to prevent a postback event when a web part is moved into a different zone? I am using the MSNBC weather web part and it fires a java script which is causing an error because the...
0
by: PhilC | last post by:
I'm not sure what I'm doing wrong here... I've created a web parts zone, and a catalog zone. Now if I create a very simple user control called "Tester": public partial class Tester :...
15
by: eladla | last post by:
Hi! I am creating a composite control the does some of it`s own data access. I want to display a progress bar between the time the page is loaded and the control place holder is displayed and...
9
Catalyst159
by: Catalyst159 | last post by:
I have a form which is used to calculate residential Floor Area Ratio (FAR). The form is structured into seven parts as follows: Part A: Maximum FAR and Floor Area: Part B: Gross Floor Area of...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
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...
0
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...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
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...
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: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
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.