Portal Engine Questions on portal engine and web parts.
Version 4.x > Portal Engine > Databound controls do not fire events View modes: 
User avatar
Member
Member
jasonlancester-gmail - 4/25/2009 11:45:22 PM
   
Databound controls do not fire events
There have been several instances in a particular application we are currently working on, where we are trying to handle events on databound controls such as a GridView or a ListView that we are manually binding in the code-behind pages and the handlers are never called.

Furthermore, when the postback completes, the control disappears from the page!

I have tried using the debugger, setting breakpoints in the event handlers, performing the action to fire the event... and it never hits the breakpoint. I tried it with and without UpdatePanel controls to see if that was causing an issue, with no difference in the results.

I initially developed and tested these controls in a sandbox project, completely independent of Kentico and everything behaved as expected. Now that the controls are integrated into Kentico, and being plugged into Kentico portal engine pages they exhibit this behavior, with identical code, save for one control that inherits from CMSAbstractWebPart (I know this has nothing to do with it, but I'm trying to emphasize the fact that the code is -identical- in every meaningful way).

I'm in no way new to ASP.NET, I realize there are pitfalls to manually binding databound controls and 'unexpected behavior' if you don't know how ASP.NET works but I am truly at a loss as to what to do about this. I've come up with workarounds but they are burdensome, in terms of both memory overhead and in just implementing and maintaining them while changing things around.

If anyone has heard of this problem before and has a suggestion, any help at this point would be greatly appreciated.

User avatar
Member
Member
jasonlancester-gmail - 4/27/2009 2:17:13 PM
   
RE:Databound controls do not fire events
Upon further investigation, setting breakpoints in the Page Load event handler and debugging: the breakpoint is hit twice. It's as though two postbacks are occurring back-to-back. This still doesn't make a whole lot of sense and is still exceedingly annoying.

Again, any help at all would be appreciated.

User avatar
Kentico Support
Kentico Support
kentico_jurajo - 5/12/2009 7:52:45 AM
   
RE:Databound controls do not fire events
Hi,

When using Portal engine templates the life cycle of controls is little bit different. Could you please try to use pre-defined web part called "User control" (General category)? HEre you will specify the path to your user control and the life cycle should be ensured. For more details please see this article.

Best Regards,
Juraj Ondrus

User avatar
Member
Member
jasonlancester-gmail - 5/12/2009 10:40:54 AM
   
RE:Databound controls do not fire events
Hi Juraj,

I appreciate your response.

I suppose I should have specified that we are using nested controls. The top-level, parent control inherits from CMSAbstractWebPart and sits directly in a web part zone on a portal engine page. However, it is composed of child user controls which are each databound in some respect and that is what seems troublesome.

I will do some more research starting with the article you referenced.

Thanks