Click here to Skip to main content
15,889,595 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am trying to create loading effect when user submits the form. While my page is processing it should show loading image and when my page stops processing it should hide the loading image. How to acheive this on button click.
JavaScript
<script type="text/javascript" language="javascript">
function svalidate() {
       var category = document.getElementById('<%=dd_category.ClientID %>').value;
            if (category == "Select Category") {
                alert("Please select Category");
                return false;
            }
        }
function loading() {
            document.getElementById("load").style.display = 'none';
        }        
</script>

ASP.NET
<div id="load">   
        <img style="margin-top:200px;" src="Images/loading.gif" alt="loading" />
        <br /><br />
        <h1 style="color:#8B7637;">Loading Please Wait..</h1>               
</div>

<asp:Button ID="but_go" runat="server" Text="Go" CssClass="gobuttonstyle" OnClientClick="return svalidate();" onclick="but_go_Click"/>
Posted
Updated 11-May-14 0:19am
v2
Comments
Sampath Lokuge 11-May-14 7:36am    
What's the problem with your code snippet ?
Raj Negi 11-May-14 11:44am    
I am able to solve the issue, actually when i click button no loading image show to me, then i put loading fuction inside the else part of svalidate function and its working fine.

1 solution

JavaScript
function svalidate() {
var category = document.getElementById('<%=dd_category.ClientID %>').value;
            if (category == "Select Category") {
                alert("Please select Category");
                return false;
            } else {
                document.getElementById("load").style.display = 'block';
            }
        }
 
Share this answer
 
v2

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