views:

179

answers:

1

I have a page that when the user clicks a button there is a custom loading panel placed in the update panel by the PageRequestManager BeginRequest event. So when the page is loaded the loading panel is removed. My issue is that when the user clicks a button that redirects to an httphandler the page is not reloaded therefore the loading panel is never removed.

So I'm trying to think of a way to remove the loading panel before the redirect occurs, whether this be with a client script call before the redirect or what ever. So far I've thought about trying to do Response.write("..."), then Response.Redirect(). But I'm open for ideas here. Thanks.

+1  A: 

put your client side code in button OnClientClick

<asp:Button ID="btn1" runat="server" OnClientClick="doSomething()" OnClick="btn1_Click" />

btn1_Click is the server side event which will happen after the client side code finish, except if you return false in the client script function.

Amr ElGarhy
Tried this one. It was actually a good thought. But I am needing the postback to happen, then before the response.redirect, I need to fire a script to hide the panel. Thanks though.
jhorton
the post back will happen after the client side finish, just put your onclick event, i edited the answer
Amr ElGarhy
@Amr- Yeah, I finally gave up on trying to fire the script. The problem was that I was calling for a Redirect to an HttpHandler which clears the response and writes a csv file into the output stream. The issue was that after the response was flushed the visible page never recieved any type of response, so any type of script was never written. But it's all good, I just canceled the LoadingPanel on that button client click. Thanks for the help.
jhorton