zoukankan      html  css  js  c++  java
  • 解决FCKeditor在ASP.NET AJAX的UpdatePanel控件中按钮回调后内容丢失的问题

      最近,打算在UpdatePanel中使用FCKeditor时,发现了一个小问题:当点击Panel内的按钮进行AsynPostBack后,FCKeditor控件中先前所录入的内容便丢失了。
           在Google上查了下,发现了解决方法:
           1.首先在页面中添加如下JS脚本:
           <script language="javascript" type="text/javascript">
            // Some Class
            function MyClass()
            {
                this.UpdateEditorFormValue = function(val)
               {       
                   for ( i = 0; i < parent.frames.length; ++i )
                            if ( parent.frames[i].FCK )
                            {    
                                    parent.frames[i].FCK.UpdateLinkedField();
                            }

               }
           }
           // instantiate the class
          var MyObject = new MyClass();

         </script>

         2.在Page_Load事件中为Button的Click添加该JS方法:
          if (!IsPostBack)
          {
                lkbPost.Attributes.Add("onclick", "if (typeof(MyObject) != \'undefined\'){
                      MyObject.UpdateEditorFormValue(); return true;}else{return true;}");
            
           }
           
          3.另外,如果在FCKeditor控件中加入了图片等信息,需要将页面的ValidateRequest设置为false。完毕。
  • 相关阅读:
    Python安装的库列表导出到文件和批量安装库文件
    Selenium之浏览器驱动下载和配置使用
    测试面试计算题--python
    软件质量模型
    用例要素和设计方法
    python的层级
    day 14:深浅copy,数据结构 ,函数,set集合,变量作用域、返回值
    day 8:open文件和with的使用
    day 1:计算机发展史和组成部分
    day 2:计算机的基础知识,编程语言分类
  • 原文地址:https://www.cnblogs.com/JackWang/p/1809450.html
Copyright © 2011-2022 走看看