0

I have a simple ASP.NET page with an image control and a button control. When someone clicks the button, I want the image to be shown, then the button can continue processing whatever it has to do, at the end of it's process it will hide the image again.

Is this possible? I've seen conflicting answers. I've tried using just the base code behind functionality and registering javascript functions on the fly (the javascript functions execute AFTER the button has completed all of its work, not before).

Thanks - Greg.

4

3 回答 3

1

In normal scenario in asp.net it is not possible.
But there are many other way

  1. User Update Panel and Update Progress from ajax tool kit and use those.
  2. Use jQuery to call server side function and show updating image while ajax is processing.

Update Progress tutorila:- http://msdn.microsoft.com/en-us/library/bb386421%28v=vs.100%29.aspx
jQuery Page Method call :- http://weblogs.asp.net/craigshoemaker/archive/2008/11/07/using-jquery-to-call-asp-net-ajax-page-methods-by-example.aspx
Jquery Ajax Loading image

于 2013-04-25T04:05:36.430 回答
0

Yes it is possible. You should use ajax call rather than code behind which will be more complicated. Very roughly, on click of the button in the javascript do something like this:

function handleClickEvent(e){ 
    $("#imgId").show(); 
    $.ajax{
           make ajax call here with right parameters; 
          success:function(){$("#imgId").hide(); 
   }}
于 2013-04-25T04:05:23.337 回答
0

First , Use JavaScript function (OnclientClick , for button ) , to show the image. and then registering javascript functions to hide it from code behind.

于 2013-04-25T04:13:32.793 回答