繁体   English   中英

.Net jQuery所见即所得隐藏在AJAX回发中

[英].Net jQuery WYSIWYG Hiding on AJAX Postback

我在.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']]
        ]
    });
});

它没有重新加载编辑器,但出现错误:

未捕获的TypeError:$(...)。summernote在Array中不是函数.....

Chrome中的错误文字

我认为主要问题是我的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']]
                                ]
                            });
                        }

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM