Proper way to clear text our of CKEditor

May 15, 2010 at 7:14 AM

I've tried:

edtEditor.Text = "";

and

edtEditor.Text.Remove(0);

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?

 

Thanks,

BK

Coordinator
May 15, 2010 at 3:28 PM

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

Use:

edtEditor.RichText.Text = string.Empty;

or edtEditor.RichText.Text = "";

With the extra "RichText" it will work

May 15, 2010 at 9: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.

 

Thanks,

BK

Coordinator
May 16, 2010 at 12: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;
}
else
{
 edtEditorText = string.Empty;
}