Need to call client script before a Response.Redirect. Any suggestions?
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 t开发者_JAVA百科o 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.
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.
精彩评论