Click here to Skip to main content
15,882,114 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
Below is aspx code,

<asp:Button ID="submtBtn" CssClass="submitBtn"  runat="server" Text="Submit" OnClick="submtBtn_Click" Style="float: right;" />


Below is cs code

protected void submtBtn_Click(object sender, EventArgs e)
        {
           Some codes to generate pdf using itext sharp

        }



The issue here is i need to show loading icon till the pdf gets generated.I have some issues using ajax so i dont want suggestion regarding ajax.

What I have tried:

I tried with ajax, loading gif is working but pdf is not generating.
Posted
Updated 19-Jun-20 7:01am
Comments
Richard MacCutchan 19-Jun-20 11:14am    
protected void submtBtn_Click(object sender, EventArgs e)
        {
           Some codes to generate pdf using itext sharp

        }

That is not code, so it is unlikely anyone can suggest how to imrove it.

1 solution

HTML
<img id="loader" style="display:none;" src="loaderImage.gif"/>
<script type="text/javascript">
    function showLoader() {
        document.getElementById("loader").style.display = 'block';
    }

</script>

<asp:Button ID="submtBtn" CssClass="submitBtn"  runat="server" Text="Submit" OnClientClick="showLoader();"
    OnClick="submtBtn_Click" Style="float: right;" />


It won't help you though, your request can only have one response so if that response is a file you can't also return html with the loader hidden, it will simply stay there and you won't be able to return any js etc to tell the image to hide.
 
Share this answer
 
Comments
Alka Singh Jun2023 10-Oct-23 2:02am    
Zz

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