Popup close on button click and redirect to different page!
I have a popup that is shown after successfully saving in the database. It shows "Password is successfully saved" and also has a "Ok" button. I want the popup to be closed when Ok is clicked and should be redirected to login page. With my code here, it saves, shows the popup, when OK is clicked,it stays on the same page. Please help me out on this! Thanks in advance!!
protected void btnOK_Click(object sender, EventArgs e)
{
Response.Redirect(ApplicationData.URL_MERCHANT_SIGNUP_PAGE, false);
Session.Remove("Info");
}
<table id="pnlPopup" runat="server" style="display:none">
<tr>
<td>
<asp:Panel ID="Panel1" runat="server" CssClass="modalPopup">
<table width="350" height="80" class="warningPopup">
<tr>
<td>
<img src="images/warning_blue.gif" alt="Warning" />
</td>
<td开发者_Go百科 colspan="2" align="left" style="padding-left: 75px; padding-top: 10px;">
Your password is succesfully been saved.
</td>
</tr>
<tr>
<td align="center" colspan="4">
<asp:Button id="btnOK" Text ="OK" runat = "server" OnClientClick="$find('mdlpop').hide(); return true;" onclick="btnOK_Click" />
</td>
</tr>
</table>
</asp:Panel>
</td>
</tr>
</table>
Place a breakpoint on this line and hit F5:-
Response.Redirect(ApplicationData.URL_MERCHANT_SIGNUP_PAGE, false);
Do you reach it?
If yes then make sure that ApplicationData.URL_MERCHANT_SIGNUP_PAGE
returns a valid URL string.
edit We need to see more code then, if the breakpoint has not been hit then the button is not forcing a post to the server. What happens if you take this bit of markup code out for now?
OnClientClick="$find('mdlpop').hide(); return true;"
this javascript function works fine. I just tested :)
function GotoRegister() { window.location = 'UserProfileNew.aspx'; return false; }
Try this on the button click
this.Page.ClientScript.RegisterStartupScript(GetType(), "dd1", "<script>window.open('URL','_top','width=500,height=200,top=300,left=300,titlebar=no,scrollbars=1,directories=0,status=0,menubar=no,toolbar=no,resizable=yes','true');</script>");
return;
ScriptManager.RegisterStartupScript(this, GetType(), "Success", "alert('data Added Successfully');location.href='secondpage.aspx'", true);
精彩评论