CustomWeb Controls and Events

M

Michael Morse

Hi Everyone,

I've got quite the unexpected problem occuring here and I can't see to
figure this out.

I've developed 2 custom controls that inherit from the WebControl class.

This first control is basically a DHTML flyout menu that allows the user to
make a selection. This control implements IPostBackEventHandler and within
the overriden "AddAttributesToRender" method I have added
"writer.AddAttribute(HtmlTextWriterAttribute.Onclick,
Page.GetPostBackClientEvent(this,"")); so that my control can raise an event
based on the postback.

Now if I add this control to a standard asp.net page and wire my controls
"ActionSelected" event to a method of the page it works just fine.

However the goal is to have my second custom control (again, derives from
WebControl) which is basically a HTMLTable use the first control. When I say
use i mean I have defined a method with the correct signature and attach this
method to the other controls "ActionSelected" event.

This never seems to work. I don't understand why a page can use the control
and listen for events but another control cannot receive the events.

Besides recieving the event everything else works and displays correctly.
Event the post back occurs - just no event being raised.

Any help GREATLY appreciated!
 
T

Teemu Keiski

Does the second control create the first one in CreateChildControls or when?
And does it implement INamingContainer interface if it does?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,226
Members
46,815
Latest member
treekmostly22

Latest Threads

Top