javascript - ASP.NET detect return File in view to hide image -


how detect when asp.net returns file? decided add following code display loading gif every time button pressed.

<script type="text/javascript"> jquery('.btn').click(function() {     jquery(".loader").show(); }); 

i have loader div, , have css displays gif. works perfectly. when button runs controller code returns redirecttoaction works perfectly. problem when controller returns file(). when redirecttoaction fires page reloads, , loading gif gone. when file returned, loading gif stays on screen.

does know how hide gif when file returned, or better way handle loading gif? i'm fine changing structure, i'll take advice.

consider using updatepanel , updateprogress controls.

updatepanel on msdn

updateprogress on msdn

to summarize

the updatepanel contains page controls , updateprogress loading gif go.

consider following example:

<asp:updatepanel runat="server" id="updexample">     <contenttemplate>         <asp:button runat="server" id="btnsubmit" text="submit"></asp:button>     </contenttemplate> </asp:updatepanel>  <asp:updateprogress runat="server" id="uppexample">     <contenttemplate>         <div class="progress-loader">             <img src="/app_themes/default/images/loader.gif" />         </div>     </contenttemplate> </asp:updateprogress> 

this should display loader gif when click on button associated form on page.

hope helps. luck.


Comments