Click here to Skip to main content
15,867,686 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
Hi friends,

am working on asp.net c#, Sqlserver 2005.

I have a button on my webpage, when i click this button it must display. Loading Please wait.

Please can you help me.

Thanks.
Posted
Updated 13-Jan-19 19:17pm

 
Share this answer
 
The easiest approach is to use jQuery or Javascript to disable any / all elements within your page after your Button was clicked and display your image. I'll provide a very basic example using the jQuery library below :

JavaScript
<!-- Example jQuery Script -->
<script src="//code.jquery.com/jquery-2.1.1.min.js"></script>
<script type='text/javascript'>
    $(function(){
      // When a Button is clicked on your page, disable everything and display your loading element
      $(':button,:submit').click(function(){
          // Disable everything
          $('*').prop('disabled',true);
          // Display your loading image (centered on your screen)
          $('body').append("<img style='top: 45%; position: absolute; height: 100px; width: 100px;background: black;left: 45%;' src='http://www.klk.com.my/wp-content/themes/klk/images/loading-ajax.gif' />");
      });
    });
</script>


As an alternative, you can try something like this as well:

JavaScript
<div id="divWait" style="position:absolute;left:50%; top:50%; margin:-100px 0 0 -150px; display:none;">
      <div style="text-align:center; width:300px; height:70px; background-color:#000; color:#fff;">
              Processing....
              <br/>
              <!--Your GIF image here-->
      </div>
</div>

<div id="divHolder">
      <!--Put your content here and form elements-->
</div>
<asp:LinkButton ID="lnkSave" runat="server" CssClass="lnkSave" />

<script type="text/javascript">
    $(".lnkSave").live("click",function(){
        $("#divHolder").attr('disabled',true);
        $("#divWait").css({'display': 'block'});
    });
</script>
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900