1

How can I show loading image for the user while executing long running process in an ASP.Net Ajax application? Is there a way other than using Page Methods? Any ideas?

NLV
  • 21,141
  • 40
  • 118
  • 183
  • might help point you in the right direction: [AJAX Progress indicator](http://encosia.com/2007/01/01/improved-progress-indication-with-aspnet-ajax/) – Christopher Klein Mar 19 '11 at 10:59

1 Answers1

2

on client side you can hook up Sys.WebForms.PageRequestManager BeginRequest:

<script type="text/javascript" language="javascript">
                Sys.WebForms.PageRequestManager.getInstance().add_beginRequest(BeginRequestHandler);
                Sys.WebForms.PageRequestManager.getInstance().add_endRequest(EndRequestHandler);
                function BeginRequestHandler(sender, args)
                {
                     var elem = args.get_postBackElement();
                     ActivateAlertDiv('visible', 'AlertDiv', elem.value + ' processing...');
                }
                function EndRequestHandler(sender, args)
                {
                     ActivateAlertDiv('hidden', 'AlertDiv', '');
                }
                function ActivateAlertDiv(visstring, elem, msg)
                {
                     var adiv = $get(elem);
                     adiv.style.visibility = visstring;
                     adiv.innerHTML = msg;                     
                }
            </script>

more info: http://msdn.microsoft.com/en-us/library/bb397432.aspx

Robert
  • 3,276
  • 1
  • 17
  • 26