ASP.NET1.1: Event sequence (Page vs. Control)?

O

Ole Hanson

Hi

I am having a number of User Controls (ascx) on my page (aspx).
The page is in my scenario only working as a dumb "container "giving life to
the Controls, as these are handling my UI-logic and communicating with each
other (the controls are communicating) by subscribing to each others events.
(e.g. pressing a selection in Control1 will "trigger" the content of
Control2).

It is done in this way:
I wire up Control2 to subscribe to events from Control1. This is done in the
Page_Load event of Control2, by first letting Controls2 obtain access to
it's parent (this.Page.Controls) and then locating Control1's events to
subscribe to. It is a quite brilliant framework letting the UI-controls
communicate via the page.

Question: How to I make sure the controls are loaded by the hosting Page,
before doing the eventwiring (Subscribe)??


/Ole
 
A

Anders Borum

Hello!

If the controls are hardcoded (e.g. by server side tag declarations), they
all participate in the control hierarchy and follow the normal control
lifecycle.

Basically you would want to ensure that the controls are available in the
control hierarchy with the same identifiers regardless of dynamic or static
instantiation (the UniqueID property of each control - ensured by the server
side tag declarations or by programmatic control).

If the controls are positioned with the same identifiers, they should be
able to respond to your events.

The wiring you've described is possible, but I would probably host the two
controls in a third parent control and handle the events there, then call
respective methods on either child control.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top