Last post Dec 17, 2009 04:58 AM by eddy556
Dec 16, 2009 10:05 AM|eddy556|LINK
I have a custom control which contains a dropdrownlist. I can access the properties of the dropdownlist by defining properties for the control which in turn affect the properties of the ddl.
I'm now in the position where I need to be able to access the DropDownList1.SelectedIndexChanged within my aspx page, however of course it is encapsulated within a custom control, so how do I expose this event as I have done with the properties?
Dec 16, 2009 10:51 AM|wtroom|LINK
Maybe this link will help
Is this a server control, or just an ASCX control? The link above is for a custom server control. Hope it helps
Dec 16, 2009 10:57 AM|_voidstar_|LINK
Create an event for your user control. This event is what your aspx (or the control host) will subscribe to. This event will tell the aspx that the dropdown's selected index has changed. Have your user control subscribe to his children's events (dropdown's
change event). Inside of the change event handler for the dropdown's change event, fire your user control's custom event to signal to the aspx that the dropdown's selected index has changed. This is called event bubbling; in a hierarchy of controls, an event
bubbles up through the hierarchy.
Dec 17, 2009 04:58 AM|eddy556|LINK
Many thanks for all your help. I have managed to get a grip with event bubbling, many thanks. The following link helped me the most