473,403 Members | 2,366 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,403 software developers and data experts.

Is there a way to reuse dynamic controls with multiple parents?

So I have a composite paging control that shoulld be positioned on the page
like this:

PagNav
ResultSetDisplay
PagNav

I know that I can't resuse the PagNav more than once in the form, so I
instantiate a couple of instances, PagNavTop and PagNavBottom, and thus I
end up with:

PagNavTop
ResultSetDisplay
PagNavBottom

The paging navigators are composed of a bunch of dynamically generated
LinkButtons and Lables. And since they should appear on the page
identically, I don't want to do the extra dynamic control creation and
calculation for the bottom one. I thought I might just re-use the same
LinkButtons and Labels in both top and bottom.

Alas, the ASP.NET framework boobytraps the dynamic controls if they're added
to another control ini the same form. Once I add them to PagNavBottom --
after adding them to PagNavTop -- they vanish from PagNavTop and will only
show up in the last parent they've been added to, PagNavBottom.

It's waste of processor cycles and memory to recreate a brand new set of
controls to each parent. I'm pretty sure that many people here in this group
have bumped into this issue, and I appreciate your feedback on how you'd
attack such a problem.

Homam
Nov 19 '05 #1
1 1187
I found out this is not possible: In ASP.NET, each control points to a
single parent. So we have the parent pointing to all the children
(Control.Controls) in addition to the child pointing up to the parent
(Control.Parent). That's why the control will always point to the last
parent it's been added to.

The quick and dirty solution is to render the controls as static HTML string
and reuse that in both places.

But I'm curious if there are neater yet efficient ways to do it.

"Homam" <ho*********************@hotmail.com> wrote in message
news:ex**************@TK2MSFTNGP09.phx.gbl...
So I have a composite paging control that shoulld be positioned on the
page like this:

PagNav
ResultSetDisplay
PagNav

I know that I can't resuse the PagNav more than once in the form, so I
instantiate a couple of instances, PagNavTop and PagNavBottom, and thus I
end up with:

PagNavTop
ResultSetDisplay
PagNavBottom

The paging navigators are composed of a bunch of dynamically generated
LinkButtons and Lables. And since they should appear on the page
identically, I don't want to do the extra dynamic control creation and
calculation for the bottom one. I thought I might just re-use the same
LinkButtons and Labels in both top and bottom.

Alas, the ASP.NET framework boobytraps the dynamic controls if they're
added to another control ini the same form. Once I add them to
PagNavBottom -- after adding them to PagNavTop -- they vanish from
PagNavTop and will only show up in the last parent they've been added to,
PagNavBottom.

It's waste of processor cycles and memory to recreate a brand new set of
controls to each parent. I'm pretty sure that many people here in this
group have bumped into this issue, and I appreciate your feedback on how
you'd attack such a problem.

Homam

Nov 19 '05 #2

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

Similar topics

1
by: John Smith | last post by:
I have a user assigned multiple roles and a role can be inherited from multiple parents (see below). How do I answer such questions as "How many roles does the user belongs to?" I answered the...
0
by: Scott P. | last post by:
I'm creating an app using ASP .NET (my second app so bear with me here) that basically builds a PDF file based on a bunch of user selections. I have a page which displays a series of checkboxs...
2
by: Michael | last post by:
Need some help trying to read values from web controls - specifically *finding* the controls (like a drop down list) - that are added dynamically added within an asp:panel control. The page...
3
by: Leo J. Hart IV | last post by:
OK, here's another question for the experts: I am building a multi-step (3 steps actually) form using a panel for each step and hiding/displaying the appropriate panel/panels depending on which...
4
by: Paul W | last post by:
i have some dynamic controls that i add to a webform (actually, i dynamiclly build a table and add the controls to cells). some of these controls are HtmlSelect controls with the multiple property...
3
by: simon | last post by:
hello, i have a form where there are multiple dropdown lists that will all be populated from the same initial data query. i have a vb class defined to make the stored proc call and that returns a...
0
by: Amil Hanish | last post by:
Can I reuse the same DataSource on a page? I have two user controls that need the data from a DataSource; can I reuse a DataSource for both controls? What would be a good way to allow my user...
3
by: Andreas Wöckl | last post by:
Hi Group! I have a web form that is created dynamically - so I create Textboxes, RadioButtonLists, CheckBoxLists and so on - I have found some articles that there may be some problems with...
2
by: englishman69 | last post by:
Hello, I have been banging my head against this one for a while... Searches online have revealed many different proposals for correcting my issue but none that I can follow! My basic situation...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
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...
0
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...
0
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,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
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...
0
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...
0
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...

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.