Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

CKEditor not working properly inside update panel

I am having a problem with CKEditor inside an update panel in asp.net. I have tab control on page with multiple CKEditor's i.e one ckeditor in each tab.

  string scriptAdd = @"var editor = CKEDITOR.instances['ctl00_ContentPlaceHolder1_faqeditor']; if (editor) { editor.destroy(true); } CKEDITOR.replace('ctl00_ContentPlaceHolder1_faqeditor');";
  ScriptManager.RegisterClientScriptBlock(this, typeof(Page), "", scriptAdd, true);

The above code snippet helps in rendering the editor in update panel. But when a postback is done it still shows the earlier value and not the changed one i.e the editor does not reflect the changes made after the tab is changed in the update panel.

The same thing works perfectly fine without update panel.

Is there any solution for this problem?

like image 695
manu5987 Avatar asked Jan 17 '23 03:01

manu5987


1 Answers

just force ckeditor to update the textarea on change :

var ckEditor = CKEDITOR.replace('ctl00_ContentPlaceHolder1_faqeditor');

ckEditor.on("change", function (event) {
    event.editor.updateElement();
});
like image 95
Chtiwi Malek Avatar answered Jan 27 '23 22:01

Chtiwi Malek