473,774 Members | 2,248 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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="btnViewRepo rt" runat="server" Text="View Report"
PostBackUrl="~/Viewer.aspx" />

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

<asp:CatalogZon e ID="CatalogZone 1" runat="server" >
<ZoneTemplate >
<asp:PageCatalo gPart ID="PageCatalog Part1"
runat="server" />
<asp:Declarativ eCatalogPart
ID="Declarative CatalogPar1" runat="server">
<WebPartsTempla te>
<PARMS:Paramete rs ID="ucParms"
runat="server" title="ABC" />
</WebPartsTemplat e>
</asp:Declarative CatalogPart>
</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. GetCurrentWebPa rtManager(page) ;
if (wpm == null)
throw new Exception(msgNo ControlID); //
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.Cou nt; 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.ToStr ing();
}
}
}

throw new Exception("Cann ot 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 1676

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

Similar topics

2
3404
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 information, but when it comes to loading the data for the user control, nothing loads. From my understanding, during postback, the user control should reload the new information based on the postback. Some information: The aspx dynamically...
1
1979
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 point out the really obvious and stupid thing I'm overlooking here. :) I have a custom control that provides a tasklist similar to what you get in certain parts of Office. On the client it consists of a bunch of nested, named and id'ed divs with...
5
2438
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 web part page? Does it take place at the page level? ...or the content area level? 3. Where is the Web Part Manager instantiated? ...in the Master Page? ....Content Page? ...elsewhere?
0
1056
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 page is posting back. Thanks in advance, Vince
0
998
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 page is posting back. Thanks in advance, Vince
0
835
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 page is posting back. Thanks in advance, Vince
0
1150
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 : System.Web.UI.UserControl { public string Caption { get { return (string)ViewState; }
15
3548
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 final display of the data from the database. I was thinking of manually opening a second thread in the Render method, but nothing is displayed before the render method exits anyway. Anyone know of a good way to do this? I have been working on this...
9
2629
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 the main floors of the main house: Part C: Gross Floor Area of the basement or cellar: Part D: Gross Floor Area of the attic:
0
9454
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,...
1
10040
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9914
tracyyun
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8939
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
7463
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
6717
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
5484
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4012
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
3611
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.