Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Problems with event bubbling

Reply
Thread Tools

Problems with event bubbling

 
 
=?Utf-8?B?UG9udGlNYXg=?=
Guest
Posts: n/a
 
      01-20-2005
1. I've got a default user control class with an event handler 'OnBubbleEvent':

public class DefaultUserControl : System.Web.UI.UserControl
{
public event EventHandler DoBubbling;
...
protected void OnBubbleEvent(EventArgs e)
{
DoBubbling(this, e);
}
...
}

2. Every user control class deriving from this default class may call that
event handler:

public class DerivedUserControl : DefaultUserControl
{
...
private void MyList_SelectedIndexChanged(object sender, System.EventArgs e)
{
OnBubbleEvent(e);
}
...
}

3. In my main page all user controls derived from the default class are
loaded dynamically:

public class MainPage : System.Web.UI.Page
{
...
private void FetchBubble(object sender, EventArgs e)
{
DefaultUserControl myControl;
if (this.Session[nameOfControl] == null)
{
myControl = (DefaultUserControl) this.LoadControl(nameOfControl);
this.Session[nameOfControl] = myControl;
myControl.ID = myControl.ToString();
}
else
{
myControl = (DefaultUserControl) this.Session[nameOfControl];
}
myControl.DoBubbling += new EventHandler(this.FetchBubble);
this.MyPanel.Controls.Add(myControl);
...
private void FetchBubble(object sender, EventArgs e)
{
this.ActivateControl();
}
}

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Event Bubbling and the ItemCommand Event Nathan Sokalski ASP .Net Web Controls 0 05-29-2006 07:16 AM
Event Bubbling and the ItemCommand Event Nathan Sokalski ASP .Net 0 05-29-2006 07:16 AM
Event Bubbling and the ItemCommand Event Nathan Sokalski ASP .Net Datagrid Control 0 05-29-2006 07:16 AM
Problems with event bubbling =?Utf-8?B?UG9udGlNYXg=?= ASP .Net 0 01-20-2005 05:05 PM
Problems with event bubbling =?Utf-8?B?UG9udGlNYXg=?= ASP .Net 0 01-20-2005 05:03 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57