Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Web Controls > Control in template does not bubble events

Reply
Thread Tools

Control in template does not bubble events

 
 
Iain
Guest
Posts: n/a
 
      06-11-2006
THis is more than likely something silly I'm doing.

(ASP.NET 2.0 W2003)

I've written a templated databound custom control which works. Except.

If I put a control (such as a LinkButton) in one of the templates, then no
event is bubble up when it is clicked.

the control is added to teh control tree (apparently correctly).

If I add the 'same' control to the Controls collection in code then the
event bubbling works correctly.

However if instead I add the control to the Controls collection of the
Container for the template (the one which I call InstatiateIn on) then,
though the control is present, no events are bubbled up. The OnEventBubble
is not called in teh container either.

In short, when I add an ASP.NET control to a templated container (thorugh
the template or code), events do not bubble. If I added in the root of the
control tree, they do.

As far as I read, this should just work. But obviously, I'm missing
something!

Iain
--
Iain Downs (DirectShow MVP)
Commercial Software Therapist
www.idcl.co.uk
 
Reply With Quote
 
 
 
 
Alessandro Zifiglio
Guest
Posts: n/a
 
      06-13-2006
hi Iain, this is happening because the events are raised in the container
control that contains instances of the controls from the inline template,
for eg. when you do : myTemplate.InstantiateIn(somecontrol) then the events
are fired in somecontrol, where you can either handle the events directly in
somecontrol or you can override onBubbleEvent in somecontrol and let it pass
up the hierarchy, in this case it will go up to the naming container
control(the control that exposes your template), where you can again
override onBubbleEvent letting it bubble up again(this time to the control
that hosts your control, possibly the page) or handle it there itself,
depending on your needs.

Good luck,
Alessandro Zifiglio


"Iain" <(E-Mail Removed)> ha scritto nel messaggio
news:wkhdrnn2o16w$(E-Mail Removed)...
> THis is more than likely something silly I'm doing.
>
> (ASP.NET 2.0 W2003)
>
> I've written a templated databound custom control which works. Except.
>
> If I put a control (such as a LinkButton) in one of the templates, then no
> event is bubble up when it is clicked.
>
> the control is added to teh control tree (apparently correctly).
>
> If I add the 'same' control to the Controls collection in code then the
> event bubbling works correctly.
>
> However if instead I add the control to the Controls collection of the
> Container for the template (the one which I call InstatiateIn on) then,
> though the control is present, no events are bubbled up. The
> OnEventBubble
> is not called in teh container either.
>
> In short, when I add an ASP.NET control to a templated container (thorugh
> the template or code), events do not bubble. If I added in the root of
> the
> control tree, they do.
>
> As far as I read, this should just work. But obviously, I'm missing
> something!
>
> Iain
> --
> Iain Downs (DirectShow MVP)
> Commercial Software Therapist
> www.idcl.co.uk



 
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
Re: C++ priority queue with bubble-up and bubble-down? mlimber C++ 0 08-05-2008 06:53 PM
Composite Control with Templates - DropDownList bubble events Marc Castrechini ASP .Net Building Controls 4 09-29-2006 09:23 AM
Events Events Events Please Help Chris ASP .Net Web Controls 0 08-30-2005 08:21 PM
howto: bubble-up events Support ASP .Net Web Controls 2 05-26-2005 03:48 PM
DataGridCommand does not bubble? Sergio Florez M. ASP .Net Building Controls 2 11-19-2004 01:13 PM



Advertisments