I have say this hierarchy in ASP.NET:
page
user control 1
user control 2
control 3
What I want to be able to do is that when control 3 (it could be any kind of control, I want to do this generically) has the user do something with it that triggers a postback, it bubbles up some event to user control 2, or maybe even user control 1 (though I could have UC 2 manually bubble the event too).
Again, I want to do this generically, so that the hierarchy can change and it still works. Maybe there are multiple controls (control 4, etc.) or a data bound control. Is this possible?
Thanks.
Event Bubbling is built into asp.net
Check this out: https://web.archive.org/web/20210324143926/http://www.4guysfromrolla.com/articles/051105-1.aspx
Basically, to raise the event that you want bubbled up:
And then to catch it:
As the code implies, if this method returns false, the event will continue to bubble up the control hierarchy
From MSDN: http://msdn.microsoft.com/en-us/library/aa719644(v=vs.71).aspx