Monday, March 26, 2012

Updating the user interface on a web form BEFORE UpdatePanel finishes

Hello

does anyone know if it is possible to dynamically alter the contents of a control (e.g. a label) so that it updates BEFORE the UpdatePanel finishes its asynchronous operation? An example might be for a progress bar. I have a process which takes up to 5 minutes, but which generates an event as it progresses. I want to update a control each time this event gets triggered, but because I update the user interface in the async part, it doesnt do anything until it has completed.

For example imagine I have a button with an OnClick event inside an UpdatePanel, alongside a label in the UpdatePanel.
WHen I click the button, if I loop through one hundred objects, andwish to update the contents of the label as I do this (i.e. 'On itemnumber: x'), how is this done?

Thanks

Tom.

Have you tried calling the .Update() method on your update panel in the loop? That may or may not work.


Take a look at this:http://encosia.com/2007/10/03/easy-incremental-status-updates-for-long-requests/


I did try this within the asyn call, but nothing happens. I am assuming that whatever happens is built into a long string of javascript or suchlike which is not executed until completion.

That's right. Output buffering prevents anything along those lines from working. Using an iframe lets you work more interactively.

No comments:

Post a Comment