Control to render out plaintext

Posted by Community Admin on 04-Aug-2018 03:13

Control to render out plaintext

All Replies

Posted by Community Admin on 07-Jul-2011 00:00

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

Posted by Community Admin on 08-Jul-2011 00:00

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

Posted by Community Admin on 08-Jul-2011 00:00

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 :)

This thread is closed