ScriptManager.RegisterStartupScript(UpdatePanel2, this.GetType(), "click", "alert('This Email address is already registered...');window.location.href ='test.aspx'", true);
通过使用上面的代码,我能够显示警告框,然后重定向到test.aspx页面。
但是当我必须传递具有以下地址的查询字符串时会出现问题:
ScriptManager.RegisterStartupScript(UpdatePanel2, this.GetType(), "click", "alert('This Email address is already registered...');window.location.href ='test.aspx?WidgetID='" + Request.QueryString["WidgetID"] + "'&lan='" + readCookie() + "'&seeHome=true'", true);
提前致谢
答案 0 :(得分:0)
您的代码有不必要的('),它会破坏javascript中的字符串。试试这个
ScriptManager.RegisterStartupScript(UpdatePanel2, this.GetType(), "click", "alert('This Email address is already registered...');window.location.href ='test.aspx?WidgetID=" + Request.QueryString["WidgetID"] + "&lan=" + readCookie() + "&seeHome=true'", true);