D
Darryl S.
Hi,
I'm trying to create a composite control composed of a
listbox and a label. I would like to bubble the
SelectedIndexChanged event of the listbox upwards to its
parent and expose it as an event (I called it
SelectedChanged) of the composite control.
I have seen egs on MSDN on how to use OnbubbleEvent() to
achieve this:
http://msdn.microsoft.com/library/default.asp?
url=/library/en-
us/cpguide/html/cpconbubblingcommandevent.asp
but the example used a Button insted of a ListBox. It
seems that OnBubbleEvent does not fire at all for the
ListBox's events (but it fires for the button's events).
any ideas?
Thanks,
Darryl.
---------Code snippet-----
using System;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.ComponentModel;
using System.Xml;
namespace UIControls
{
public class SelectionList :
System.Web.UI.WebControls.WebControl, INamingContainer
{
.....code...
private ListControl theList = new ListBox
();
public event EventHandler SelectionChanged;
protected override bool OnBubbleEvent
(object source, EventArgs e) {
OnSelectionChanged(e);
return false;
}
protected virtual void OnSelectionChanged
(EventArgs e) {
if (SelectionChanged != null){
SelectionChanged(this, e);
}
}
I'm trying to create a composite control composed of a
listbox and a label. I would like to bubble the
SelectedIndexChanged event of the listbox upwards to its
parent and expose it as an event (I called it
SelectedChanged) of the composite control.
I have seen egs on MSDN on how to use OnbubbleEvent() to
achieve this:
http://msdn.microsoft.com/library/default.asp?
url=/library/en-
us/cpguide/html/cpconbubblingcommandevent.asp
but the example used a Button insted of a ListBox. It
seems that OnBubbleEvent does not fire at all for the
ListBox's events (but it fires for the button's events).
any ideas?
Thanks,
Darryl.
---------Code snippet-----
using System;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.ComponentModel;
using System.Xml;
namespace UIControls
{
public class SelectionList :
System.Web.UI.WebControls.WebControl, INamingContainer
{
.....code...
private ListControl theList = new ListBox
();
public event EventHandler SelectionChanged;
protected override bool OnBubbleEvent
(object source, EventArgs e) {
OnSelectionChanged(e);
return false;
}
protected virtual void OnSelectionChanged
(EventArgs e) {
if (SelectionChanged != null){
SelectionChanged(this, e);
}
}