manu5987 manu5987 - 3 months ago 85
ASP.NET (C#) Question

CKEditor not working properly inside update panel

I am having a problem with CKEditor inside an update panel in
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?


Sorry for the late response on this, but the answer may be helpful to others as well. You also need to do the following in code behind:

ScriptManager.RegisterOnSubmitStatement(this, this.GetType(), "updatescript", "CKEDITOR.instances['ctl00_ContentPlaceHolder1_faqeditor'].updateElement();");

Hope this helps.