This is a migrated thread and some comments may be shown as answers.

RadEditor pulling back HTML instead of text

1 Answer 78 Views
WebParts for SharePoint
This is a migrated thread and some comments may be shown as answers.
Neo
Top achievements
Rank 1
Neo asked on 09 Apr 2013, 04:53 PM
We have an event receiver that gets called on ItemAdded of a list. This list implements the RadEditor on a 'Body' field. When the code grabs the value of this field, is contains the entire markup instead of just the text which the user has entered in the editor. How do we just get the text and not the HTML?
public override void ItemAdded(SPItemEventProperties properties)
{
    SPListItem postItem = properties.ListItem;
      string body = postItem["Body"]; //This returns all markup - we only want the user entered text from radeditor
}

1 Answer, 1 is accepted

Sort by
0
Stanimir
Telerik team
answered on 11 Apr 2013, 06:15 AM
Hello Michael,

RadEditor is a control which produces HTML/XHTML content. Adding such content to the list's rich text and enhanced rich text fields is what the control does. It has a server Text property which will return you the plain text, which is entered in the control. However I am not sure if you can get a reference to the editor in your feature receiver. If you can not get the reference, you will need to implement the HTML stripping functionality your self. By purchasing RadControls for ASP.NET AJAX you gain access to the source code of the controls. You can download the source of the Telerik.Web.UI assembly an check the implementation of the RadEditor's Text property. It is located in the Editor/RadEditor.Properties.cs file.

All the best,
Stanimir
the Telerik team
Learn how the Telerik controls can be integrated in SharePoint 2007/2010 from this resource. To watch them in action, explore our online SharePoint 2010 and SharePoint 2007 demo sites.
Tags
WebParts for SharePoint
Asked by
Neo
Top achievements
Rank 1
Answers by
Stanimir
Telerik team
Share this question
or