RadEditor pulling back HTML instead of text

2 posts, 0 answers
  1. Neo
    Neo avatar
    30 posts
    Member since:
    May 2009

    Posted 09 Apr 2013 Link to this post

    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
  2. Stanimir
    Stanimir avatar
    1654 posts

    Posted 11 Apr 2013 Link to this post

    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,
    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.
Back to Top