Wednesday, March 28, 2012

Treating an ASCX control as independent

One huge disadvantage of the UpdatePanel control, IMHO, is that all of the Page life cycle reloads again.

I was wondering, when I just want to load a single control that has nothing to do with the rest of the stuff on the page, is this roundtrip really necessary?

I know that there's the client approach which says I can communicate with the server with minimal data and create all controls at the client-side, but that won't let me use server-controls and their benefits.

I thought of something that renders an ASCX control and serves its HTML, but it not covers everything, such as event firing.

Is my idea doable? Anyone bumped into this before?

Thanks!

If you want the benefits of the server controls you must also allow their life cycle to run. It's both the advantage and the disadvantage of the UpdatePanel.


Agreed... This is discussed here:http://encosia.com/index.php/2007/07/11/why-aspnet-ajax-updatepanels-are-dangerous

One option is to use ASP.NET PageMethods (also described in that link) which simplifies WebMethod calls and only returns results and not much overhead. You can also use multiple UpdatePanels so that you aren't refreshing so much.

Hope this helps,

-Damien

No comments:

Post a Comment