asp.net-mvchtmlumbracorte

Umbraco how to stop Rich Text Box to automatically add <p> tag in html


I am developing a website in umbraco, the problem is when i insert my html in rich text editor it automatically inserts "p" (Paragraph Tag) tag in the html which is destroying my design.Please help me, i am stuck here.

Thank you.


Solution

  • How are you adding the page field onto your markup? Through a view or as a pagefield?

    If you're adding it as a pagefield add the attribute stripParagraph="true"

    If you're adding in a view then you could try

    Html.Raw(library.RemoveParagraphTags(Model.bodyText.ToString()))

    But that will only remove the first one

    You could roll your own version of that method to remove all P tage, or try what's suggested here - http://scottsdevblog.com/2011/08/get-rid-of-those-pesky-p-tags-in-umbracos-tinymce-editor/