c# - .Net jQuery WYSIWYG 隐藏在 AJAX 回发上
问题描述
我在我的 .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']]
]
});
});
它没有重新加载编辑器,我收到错误:
Uncaught TypeError: $(...).summernote is not a function at Array.....
解决方案
我认为主要问题是我的 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']]
]
});
}
推荐阅读
- airflow-scheduler - 从 DAG 文件夹中挑选 dag 时出现气流延迟
- php - 如何自定义 laravel auth 用户
- c++ - 如何访问共享内存中分配的数组元素
- c++ - 比较不一定与同一数组关联的指针
- angular - 打字稿函数中的错误-函数缺少结束返回语句并且返回类型不包括“未定义”
- flutter - 使用 Flutter Amplify 应用程序的用户和管理员登录
- python-3.x - 读取 csv 文件并需要获取带有月份和终止计数的 dict,但出现此错误:'int' 类型的参数不可迭代
- python - 我如何在一个命令中滚动多个骰子
- python - 使用 Python 将原始 Jupyter Notebook 转换为 JSON 列表
- flutter - 未来
不能分配给列表类型