【问题标题】:.Net jQuery WYSIWYG Hiding on AJAX Postback.Net jQuery WYSIWYG 隐藏在 AJAX 回发上
【发布时间】:2018-12-12 13:29:43
【问题描述】:

我在我的 .Net 应用程序中使用 WYSIWYG 编辑器 Summernote。当我使用 AJAX 回发时,表单工作正常,但是所见即所得消失了。我收集我需要再次运行初始化程序。我正在使用下面的代码来尝试。

<script>
$('#<%=txtDescription.ClientID%>').summernote({
    tabsize: 2,
    height: 100,
    toolbar: [
        ['style', ['bold', 'italic', 'underline']],
        ['color', ['color']],
        ['para', ['ol', 'paragraph']],
        ['insert', ['link', 'picture', 'video', 'table', 'hr']]
    ]
});

var prm = Sys.WebForms.PageRequestManager.getInstance();
prm.add_endRequest(function (s, e) {
    $('#<%=txtDescription.ClientID%>').summernote({
        tabsize: 2,
        height: 100,
        toolbar: [
            ['style', ['bold', 'italic', 'underline']],
            ['color', ['color']],
            ['para', ['ol', 'paragraph']],
            ['insert', ['link', 'picture', 'video', 'table', 'hr']]
        ]
    });
});

它没有重新加载编辑器,我得到了错误:

未捕获的类型错误:$(...).summernote 不是函数 在数组.....

Error text in Chrome

【问题讨论】:

    标签: c# jquery .net ajax


    【解决方案1】:

    我认为主要问题是我的 jQuery 和 Bootstrap 引用不准确。下面的代码最终奏效了。

    function pageLoad() { // this gets fired when the UpdatePanel.Update() completes
                                $('#<%=txtDescription.ClientID%>').summernote({
                                    tabsize: 2,
                                    height: 100,
                                    toolbar: [
                                        ['style', ['bold', 'italic', 'underline']],
                                        ['color', ['color']],
                                        ['para', ['ol', 'paragraph']],
                                        ['insert', ['link', 'picture', 'video', 'table', 'hr']]
                                    ]
                                });
                            }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2012-07-06
      • 2019-12-22
      • 1970-01-01
      • 1970-01-01
      • 2011-12-29
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多