如何使用 C# ASP.NET 在 GridView 行不处于编辑模式时禁用 CKeditor

分享于2022年09月08日 asp.net c# ckeditor gridview 问答
【问题标题】:How to disable CKeditor when row of GridView it's not in edit mode using C# ASP.NET如何使用 C# ASP.NET 在 GridView 行不处于编辑模式时禁用 CKeditor
【发布时间】:2022-08-01 22:33:08
【问题描述】:

我在 GridView 上的 Web 应用程序中使用 CKEditor ,需要从 javascript 禁用/启用编辑器。

如果 gridview 行不在编辑模式下,我需要禁用编辑器,否则我需要启用编辑器。

我知道有一个名为 readOnly 的选项,我尝试过使用 config.js

CKEDITOR.editorConfig = function (config) {

    config.removePlugins = 'bidi,image,forms,adobeair,devtools,find,maximize,a11yhelp,about,divarea,liststyle,tabletools,tableresize,contextmenu,codemirror,docprops,preview,smiley,sourcearea,save,flash,iframe,tabletools,templates,showblocks,newpage,language,print,div';

    config.width = '700';
    config.height = '200';

    config.readOnly = true;
};

但是当gridview的行不在编辑模式时,即使无法保存文本,它仍然可以在编辑器中写入

请问有人知道如何禁用和启用CKEditor吗?


    

        
        

    


【解决方案1】:

尝试在gridview中实现


    

    
      
      
      Read-only mode
      
    

    
      
      

链接: http://jsfiddle.net/7v091ebd/

资源: https://ckeditor.com/docs/ckeditor4/latest/examples/readonly.html

【讨论】: