Proper way to clear text our of CKEditor

May 15, 2010 at 8:14 AM

I've tried:

edtEditor.Text = "";



and neither one clears the text.  I'm using:

edtEditor.Text = " ";

and it replaces the text with a single space but that's not a good way.

How do you clear the text in a CKEditor in the server side code?




May 15, 2010 at 4:28 PM

Take me some time and some Researching But i Find A Solution !!!!


edtEditor.RichText.Text = string.Empty;

or edtEditor.RichText.Text = "";

With the extra "RichText" it will work

May 15, 2010 at 10:27 PM

Thanks for making the effort to figure that out.  Yup it works fine...except.

If I load the editor up with some text and then switch to Basic Text Editor using edtEditor.RichText.Text = string.Empty; doesn't work.  It seems to clear if it's in Rich Text mode but not in Basic Text.




May 16, 2010 at 1:23 PM

Yes of Course in Basic Mode it Can not Work, it must be edtEditor.Text = string.Empty:

you could write

if (edtEditor.Mode.Equals("RICH"))
 edtEditor.RichText.Text = string.Empty;
 edtEditorText = string.Empty;