J
Jordan S.
I'm just wondering if this would work. Please note that I'm not asking *how*
to raise events. I'm clear on that. What I'm not clear on is the sequence in
which events are raised by custom controls relative to the hosting Page, and
therefore if the following specific arrangement would even work.
What I'm looking to do is dynamically insert multiple custom composite Web
server controls onto a blank Page. This is no problem, I know how to do this
part.
What I need is for one of these controls to "broadcast" events of interest
to any other controls on the hosting Page that may be interested. But I do
not want for any of the controls on the page to directly know anything about
each other (hold references to each other).
So, to make this happen I am thinking that this would work:
A control gets notified - via the hosting Page - of the event originating
in another control.
Specifically:
1. During PostBack, control #1 raises an event (that is of interest to
Control #2).
2. The hosting Page is subscribed to the event in Control #1
3. The hosting page then raises an event of its own, passing along the
EventArgs received from Control #1.
4. Control #2 is subscribed to the Page's event [that is raised in step 3
above], and consequently receives notification (from the Page) that includes
a copy of the EventArgs-derived class sent from Control #1.
Will this work? Will ASP.NET, during PostBack, raise the events in the
correct sequence? (Control riases event ----- page raises another
vent ----- Control handles event raised by Page)
Thanks!
to raise events. I'm clear on that. What I'm not clear on is the sequence in
which events are raised by custom controls relative to the hosting Page, and
therefore if the following specific arrangement would even work.
What I'm looking to do is dynamically insert multiple custom composite Web
server controls onto a blank Page. This is no problem, I know how to do this
part.
What I need is for one of these controls to "broadcast" events of interest
to any other controls on the hosting Page that may be interested. But I do
not want for any of the controls on the page to directly know anything about
each other (hold references to each other).
So, to make this happen I am thinking that this would work:
A control gets notified - via the hosting Page - of the event originating
in another control.
Specifically:
1. During PostBack, control #1 raises an event (that is of interest to
Control #2).
2. The hosting Page is subscribed to the event in Control #1
3. The hosting page then raises an event of its own, passing along the
EventArgs received from Control #1.
4. Control #2 is subscribed to the Page's event [that is raised in step 3
above], and consequently receives notification (from the Page) that includes
a copy of the EventArgs-derived class sent from Control #1.
Will this work? Will ASP.NET, during PostBack, raise the events in the
correct sequence? (Control riases event ----- page raises another
vent ----- Control handles event raised by Page)
Thanks!