我用asp.net中做了一个弹框的效果,可是却报错,应该显示“已到达最顶端,不能上移”,我用Response.Write('alert('已在最上端,不能上移!');')做的。
报异常:Sys.WebForms.PageRequestManagerErrorException:The message received from the server could not be parsed

解决方案 »

  1.   

    Response.Write('alert('已在最上端,不能上移!');')
    改为:
    Response.Write("alert('已在最上端,不能上移!');")
    注意引号
      

  2.   

    Response.Write("<script>alert('已在最上端,不能上移!');</script>")
      

  3.   

    Response.Write(" <script>alert('已在最上端,不能上移!'); </script>")
      

  4.   

    Response.Write("<script>alert('已在最上端,不能上移')</script>");试试这个
      

  5.   

    楼主用的updatepanel吧,这种情况下不允许使用Response.Write
    试试ScriptManager.RegisterStartupScript(this.page, typeof(Page), "RedirectTo",alert('已在最上端,不能上移!'), true);
      

  6.   

    如果用了Updatepanel的话,要用scriptManager
    用Page.RegisterStartScript也不行
      

  7.   

    如果用了Updatepanel的话,要用scriptManager 
    用Page.RegisterStartScript也不行,可以考虑将Button按钮或是触发事件的按钮放到ContentTemplate外,然后用Trigger标签关联按钮id
      

  8.   

    Response.Write(" <script>alert('已在最上端,不能上移') </script>");
      

  9.   

    谢谢了,我用scriptManager 成功了