此客户端脚本在没有查询字符串的情况下工作,但不显示
ClientScript.RegisterStartupScript(this.GetType(), "alert", "alert('POSTED SUCCESSFULLY');document.location.href='/Group.aspx?grp_id='"+ Group_ID.Value +"'&grp_name='"+ Group_Name.Value +"'';", true);
答案 0 :(得分:1)
现在您的代码将输出与此类似的js代码:
alert('POSTED SUCCESSFULLY');document.location.href='/Group.aspx?grp_id='1'&grp_name='yourgroupname'';
那里有一些语法错误。将其更改为没有必要的单引号和UrlEncode Group_ID
和Group_Name
的值,因此它们对网址友好(可能没有必要,但我建议它):< / p>
"alert('POSTED SUCCESSFULLY');document.location.href='/Group.aspx?grp_id="+ HttpServerUtility.UrlEncode(Group_ID.Value) +"&grp_name="+ HttpServerUtility.UrlEncode(Group_Name.Value) +"';"