Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
Hi,
I have some content (from rte) wrapped in a paragraph. How do I remove the paragraph without having the rest of the html-tags removed or handled as plain text?
This will work:
<h1>@Umbraco.Field("CoverHeadline", removeParagraphTags: true)</h1>
... BUT I want to use the Model to get it more strongly typed ... and the following will (of course) generate an error:
<h1>@Umbraco.Field(Model.Content.CoverHeadline, removeParagraphTags: true)</h1>
I have tried this (and many more variants):
<h1>@umbraco.library.RemoveFirstParagraphTag(Model.Content.CoverHeadline.ToString())</h1>
... the paragraph is removed but the rest of the html is shown as plain text (tags are shown as text).
I have tried this as well:
@Umbraco.StripHtml(Model.Content.CoverHeadline.ToString(), "p")</h1>
... but it removes both the paragraph and all other html-tags (a span and a break) "inside" the paragraph.
I have tried with a helper-class, regex and much more - but the result is html as plain text.
Any suggestions?
Hi Marrix
Try this code:
Html.Raw(library.RemoveFirstParagraphTag(Model.Content.CoverHeadline.ToString()))
Alex
YES! Thanks a lot. That will do the job :-)
You are welcome, Marrix.
Have a great day, ask questions on our forum!
I will (ask questions) - be sure on that :-D Thanks...
is working on a reply...
Write your reply to:
Upload image
Image will be uploaded when post is submitted
Remove html paragraph
Hi,
I have some content (from rte) wrapped in a paragraph. How do I remove the paragraph without having the rest of the html-tags removed or handled as plain text?
This will work:
... BUT I want to use the Model to get it more strongly typed ... and the following will (of course) generate an error:
I have tried this (and many more variants):
... the paragraph is removed but the rest of the html is shown as plain text (tags are shown as text).
I have tried this as well:
... but it removes both the paragraph and all other html-tags (a span and a break) "inside" the paragraph.
I have tried with a helper-class, regex and much more - but the result is html as plain text.
Any suggestions?
Hi Marrix
Try this code:
Alex
YES! Thanks a lot. That will do the job :-)
You are welcome, Marrix.
Have a great day, ask questions on our forum!
I will (ask questions) - be sure on that :-D Thanks...
is working on a reply...