Home All Groups Group Topic Archive Search About
Author
31 Aug 2006 4:31 AM
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!

Author
5 Sep 2006 3:46 PM
Teemu Keiski
Does the second control create the first one in CreateChildControls or when?
And does it implement INamingContainer interface if it does?

--
Teemu Keiski
ASP.NET MVP, AspInsider
Finland, EU
http://blogs.aspadvice.com/joteke


Show quoteHide quote
"Michael Morse" <MichaelMo***@discussions.microsoft.com> wrote in message
news:4FAE4840-6486-4CC0-969D-808BD974AEBB@microsoft.com...
> 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!