Yeah that may be! I assumed that he wanted the html, but not to show to the end user :) it's a common error to output html in a string in ASP and being surprised by the automatic encoding
Hey guys ... I've been looking for a solution to this. While I see that you have flagged this as a solution, and I wasn't exactly sure how to apply it. So I've been kicking this around for the last few days and finally found a reference that helped me wrap my head around it. Here's what I found and what I used to apply it to an archetype fieldset:
@Html.Raw(Model.GetValue<string>("text")) <-- the example
<div>@Html.Raw(@fieldset.GetValue<string>("hIntro"))</div> <-- the example applied
My RTE's that are inside of an archetype were rendering both paragraph tags AND span tags for the custom CSS allowed by the style referenced in the RTE. This solution strips the tags out, and the css style allowed by the RTE is will render properly (unless it's an archetype referenced from another page ... still working on resolving that angle).
Archetype RTE property rendering <p> tag
Hi I have created an Archetype data type with an RTE property. RTE content from the Archetype data type is rendering the
<p>
A RTE property editor on a template renders content without the
<p>
tag. how can i remove thetags from the Archetype data type RTE ?
Dibs
Hi Dibs
This is typical issue, try to use @umbraco.library:RemoveFirstParagraphTag(Model.myfield) method.
Hope it will help you.
Thanks,
Alex
Have you tried casting it to an
IHtmlString
so that asp will not encode it? Either that or render it usingHtml.Raw(string)
Or as said Stefano
Why stripping html?
As I understood question was "how can i remove the tags from the Archetype data type RTE ?"
Yeah that may be! I assumed that he wanted the html, but not to show to the end user :) it's a common error to output html in a string in ASP and being surprised by the automatic encoding
Dibs, we want to know what is the problem now? ))
Hi Guys
Maybe lack of ASP knowledge on my side, this is what is happening. I have created a Archetype Data Type with two nested properties, a textbox and RTE.
When adding content, to the RTE,it renders the text with
<P>
tags when viewing the page on front end@Html.Raw fixed it thanks
Dibs
What happens is that ASP encodes strings by default (mostly for security I imagine). Html.Raw bypasses it.
Could you please mark the answer as the solution?
Cheers Stefano
Hey guys ... I've been looking for a solution to this. While I see that you have flagged this as a solution, and I wasn't exactly sure how to apply it. So I've been kicking this around for the last few days and finally found a reference that helped me wrap my head around it. Here's what I found and what I used to apply it to an archetype fieldset:
My RTE's that are inside of an archetype were rendering both paragraph tags AND span tags for the custom CSS allowed by the style referenced in the RTE. This solution strips the tags out, and the css style allowed by the RTE is will render properly (unless it's an archetype referenced from another page ... still working on resolving that angle).
is working on a reply...