public static void setupScripts(Page page)
{
//page.ClientScript.RegisterClientScriptInclude("Swaf.CkEditorMain", page.ResolveUrl(CkEditorJS));
ScriptManager.RegisterClientScriptInclude(page, typeof(CkEditor), "Swaf.CkEditorMain", page.ResolveUrl(CkEditorJS)); //NRChange - using ScriptManager for partial postback support
}
protected override void OnPreRender(EventArgs e)
{
base.OnPreRender(e);
setupScripts(Page);
//NRChange - Added to handle partial postbacks
ScriptManager.RegisterOnSubmitStatement(this, typeof(CkEditor), "CKEditorAjaxOnSubmit_" + ClientID, string.Format("try{{var e = CKEDITOR.instances.{0}; if (e != null)e.updateElement();}}catch(err){{}};", ClientID));
}
protected override void Render(HtmlTextWriter writer)
{
writer.Write("<textarea id='{0}' name='{1}'></textarea>", ClientID, UniqueID);
//writer.Write("<script type='text/javascript'>var t=\"{2}\";var e = CKEDITOR.instances.{0};if(e != null)CKEDITOR.remove(e);CKEDITOR.replace('{0}'{1}).setData(t);</script>",
// ClientID, buildConfigOptions(), getTextForRender());
//NRChange - using ScriptManager for partial postback support
ScriptManager.RegisterStartupScript(this, typeof(CkEditor), "startup" + ClientID, ""
+ "var t=\"" + getTextForRender() + "\";"
+ "var e = CKEDITOR.instances." + ClientID + ";"
+ " if(e != null)CKEDITOR.remove(e); "
+ "CKEDITOR.replace('" + ClientID + "'" + buildConfigOptions() + ").setData(t);"
//+ "var newEditor = CKEDITOR.instances." + ClientID + ";"
//+ "alert('text set to: ' + t);"
//+ "alert('current text: ' + newEditor.getData());"
+ "", true);
}
http://www.netreach.com/ckeditor_concern/

Re: UpdatePanle and Partial postback
protected override void OnPreRender(EventArgs e) { base.OnPreRender(e); setupScripts(Page); if (Visible) { //The following scripts were first written by Daniel Cohen Gindi danielgindi@gmail.com and posted to // the CKEditor forums for use as part of the ASP.Net control replacement for FCKEditorControl2. // See the thread at http://cksource.com/forums/viewtopic.php?t=15882 for full discussion var onSubmitScript = string.Format( @"if (CKEDITOR && CKEDITOR.instances && CKEDITOR.instances.{0}) {{ var e=document.getElementById('{0}'); if(e) {{ var i=CKEDITOR.instances.{0}; e.value=i.getData(); i.fire('destroy'); }} }};", ClientID); ScriptManager.RegisterOnSubmitStatement(this, typeof(CkEditor), "CKEditorAjaxOnSubmit_" + ClientID, onSubmitScript); var startupScript = string.Format( @"document.getElementById('{0}').dispose=function(){{ if (CKEDITOR && CKEDITOR.instances && CKEDITOR.instances.{0}) {{ var e=document.getElementById('{0}'); if(e) {{ var i=CKEDITOR.instances.{0}; CKEDITOR.remove(i); }} }} }};", ClientID); ScriptManager.RegisterStartupScript( this, typeof(CkEditor), ClientID + @"_Dispose", startupScript, true); var instanceScript = string.Format( @" if (CKEDITOR && CKEDITOR.instances && CKEDITOR.instances.{1}) {{CKEDITOR.instances.{1}.destroy();}} var text = '{0}'; CKEDITOR.replace('{1}'{2}).setData(text);", getTextForRender(), ClientID, buildConfigOptions()); ScriptManager.RegisterStartupScript(this, typeof(CkEditor), "startup_" + ClientID, instanceScript, true); } } protected override void Render(HtmlTextWriter writer) { writer.Write("<textarea id='{0}' name='{1}'></textarea>", ClientID, UniqueID); }