0
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);

提前致谢

4

1 回答 1

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);
于 2012-04-10T06:41:21.960 回答