Hello Michael,
first, thanks very much for your answer.
On Tue, 25 May 2004 16:04:52 -0400, "Raterus" <ra*****@spam.org>
wrote:
Is it really necessary to delegate (or bubble) the event from usrA to
the web form, then delgate the event from the web form to usrB, and
finally delegate the event from usrB to usrBB?
Yes! You break the Object-orientated approach to it if you do it any other way. (I'm not saying it can't be done, but I wouldn't do it) Create an event your usercontrol fires which you handle at your main page, and then push your way down to usrBB through usrB.
--Michael
The main problem is that there is no event broadcasting.
Another problem is exactly this 'push your way down to usrBB through
usrB'.
Version1:
usrBB's Event-Handler is public, usrBB is a public member of usrB,
usrB and usrA are members of webForm1.
webForm1 registers usrBB's Event-Handler something like:
this.usrA.UsrA_ListChanged += new
usrA.UsrA_ListChangedHandler(this.usrB.usrBB.UsrA_ ListChanged);
Version2:
I have to define a new event in webForm1. usrB has to register for
this event. I have to define another new event in usrB to have usrBB
registered. These new events are only for delegating the webForm1's
event (coming from the ddList in usrA) to usrBB.
Version3:
as described in
http://www.123aspx.com/redir.aspx?res=28491
Here the casts get very ugly although he 'only' has to transfer events
between User Controls directly under the main web form.
I have decided to use Version1, so I break encapsulation. Version2
just seems too cumbersome to me.
Now, suppose I hat to put another usrB1 in between usrB and usrBB.
Then I had to close the chain the hard way...
Best regards
Johannes
Well, in a way I have to break the Object-oriented approach, I have to
break encapsulation.