1-888-365-2779
+1-888-365-2779
Try Now
More in this section

Forums / Developing with Sitefinity / Control to render out plaintext

Control to render out plaintext

3 posts, 0 answered
  1. Steve
    Steve avatar
    3037 posts
    Registered:
    03 Dec 2008
    07 Jul 2011
    Link to this post
    The "Content" data of the News module is html

    But I have a need to convert that Html content to just plaintext to display on the page (inside of a widget template)

    Is there a built-in control which will do just that? FieldListView, HtmlField, Something?

    I know I can feed it though the RadEditor, was just wondering if there was an easier way.

    Steve
  2. Boyan Barnev
    Boyan Barnev avatar
    1429 posts
    Registered:
    16 Aug 2017
    08 Jul 2011
    Link to this post
    Hi Steve,

    An option would be to use HtmlField control, as you pointed out. Can you, please, try using this sample code:
    <sitefinity:HtmlField runat="server" DisplayMode="Read" Value='<%# Eval("Content")%>' />
    Alternatively you can use sitefinity:TextField which does not render Html by default, so by using Value='<%# Eval("Content")%>' you'll get the plain text displayed (however, please have in mind that the Html tags will also be displayed on the frontend as plain text)

    Best wishes,
    Boyan Barnev
    the Telerik team
    Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  3. Steve
    Steve avatar
    3037 posts
    Registered:
    03 Dec 2008
    08 Jul 2011
    Link to this post
    So is their a hybrid of the two that would work?

    Like feed in the HTML, but the output would be like TextField?

    Essentially I just want all Markup stripped out....

    Its a news\event viewer and with HTML enabled the styling just looks strange :)
3 posts, 0 answered