弹出关闭按钮单击并重定向到不同的页面!

时间:2010-10-21 02:34:51

标签: c# asp.net html ajax

我在成功保存到数据库后显示了一个弹出窗口。它显示“密码已成功保存”,并且还有一个“确定”按钮。我希望在单击“确定”时关闭弹出窗口,并将其重定向到登录页面。使用我的代码,它会保存,显示弹出窗口,单击“确定”时,它会保留在同一页面上。请帮我解决这个问题!在此先感谢!!

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 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>

4 个答案:

答案 0 :(得分:2)

在此行上放置一个断点并点击F5: -

Response.Redirect(ApplicationData.URL_MERCHANT_SIGNUP_PAGE, false);

你到达了吗?

如果是,请确保ApplicationData.URL_MERCHANT_SIGNUP_PAGE返回有效的URL字符串。

编辑我们需要查看更多代码,如果没有点击断点,则按钮不会强制发布到服务器。如果你现在拿出这个标记代码怎么办?

  

的OnClientClick =“$查找( 'mdlpop')隐藏();   返回true;“

答案 1 :(得分:1)

这个javascript函数运行正常。我刚刚测试过:)

function GotoRegister() {     window.location ='UserProfileNew.aspx';     返回false; }

答案 2 :(得分:0)

点击按钮

尝试此操作
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;

答案 3 :(得分:0)

ScriptManager.RegisterStartupScript(this,GetType(),“Success”,“alert('数据已成功添加'); location.href ='secondpage.aspx'”,true);

相关问题