tags:

views:

51

answers:

4
+1  A: 

You might find the discussion on this question helpful:

http://stackoverflow.com/questions/1498269/asp-net-double-click-problem

The solution(s) deal only with the button, but you could extend the idea to disabling more of the DOM and showing a hidden div with your message as part of the client click function.

kbrimington
+1  A: 

You should be able to use a bit of jQuery to find the buttons, and disabled them. When I've done this in the past I've also changed the text of the button to "Please Wait...". I wired up the client onclick in conjunction with the postback of the button.

It worked great for me as it stopped the button from being pressed again and also gave the user an immediate visual feedback that they'd successfully clicked the button.

If you need an example I'm sure I can dig out some code for you.

Antony Scott
A: 

If you want the page to be updated before the postback result comes back, you'll have to use javascript, something like this. This is a general approach, that you should probably customize to what you need.

In your html:

<head>
  <script type="text/javascript">
    function ShowWait() {
      document.getElementById('labelspan').innerText = 'Loading...';
    }
  </script>
</head>

In the page setup:

BtnEnvoyer.OnClientClick = "ShowWait();";

Then when the button is clicked, ShowWait will apply whatever visual effects you want while the postback is actually processing. As soon as it's ready, the whole page will be replaced with the results of the postback.

recursive
+1  A: 

I asked a very similar question a few weeks ago: http://stackoverflow.com/questions/3527634/asp-net-custom-button-control-how-to-override-onclientclick-but-preserve-existi

The class i created can be dropped onto any form and will prevent double-clicks.

Essentially, i am setting the button to "disabled", but there is nothing stopping you from extending that to call your own client-side code.

You're best bet is to disable the button (like i did), and also show a hidden DIV which contains an animated gif (AJAX loading image).

RPM1984