zoukankan      html  css  js  c++  java
  • ASP.NET中使用UpdatePanel时用Response输出出现错误的解决方法

    asp.net中执行到Response.write("xx");之类语句或Microsoft JScript 运行时错误: Sys.WebForms.PageRequestManagerParserErrorException: 无法分析从服务器收到的消息。之所以出现此错误,常见的原因是: 在通过调用 Response.Write() 修改响应时,将启用响应筛选器、HttpModule 或服务器跟踪。  
      在放置了UpdatePanel时,先在</UpdatePanel>前加入
        <Triggers><asp:AsyncPostBackTrigger ControlID="Timer1"/></Triggers>试试,如果是设置了PostBackTrigger 也无法Response.Write();正常情况下,微软推荐我们是这么用的:
                    string scripts = "<script>alert('弹出提示框!');</script>";
                    ClientScriptManager csm = Page.ClientScript;
                    csm.RegisterClientScriptBlock(this.GetType(), "sss", scripts, false);
                    //csm.RegisterStartupScript(this.GetType(),"sss",scripts,false);
    如果还不行你就用专门针对UpdatePanel控件的:
    ScriptManager.RegisterStartupScript(this.UpdatePanel1, this.GetType(), "updateScript", "alert('未登录!');", true);
    你只需将alert('未登录!');改成你要输出的脚本即可!

    参考:http://wangyali90516.blog.163.com/blog/static/117205101201083025730557/


    作  者:浮云也是种寂寞
    出  处:http://www.cnblogs.com/summit7ca/
    版权声明:本文版权归作者和博客园共有,欢迎转载,但未经作者同意必须保留此段声明,且在文章页面明显位置给出原文链接。
    若您觉得这篇文章还不错请点击推荐按钮,有了您的支持才能激发作者更大的写作热情,非常感谢。

  • 相关阅读:
    mysql 日志
    mysql 事务中的锁
    mysql 事务的日志
    mysql 核心事务特性
    mysql 断电导致表打不开解决方案
    mysql 数据库逻辑升级
    mysql innodb存储引擎的表空间
    IDEA常用代码模板
    springcloud-GateWay常用的Predicate
    springcloud-GateWay配置动态路由
  • 原文地址:https://www.cnblogs.com/summit7ca/p/4023550.html
Copyright © 2011-2022 走看看