Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Charles 42 posts 63 karma points
    Mar 25, 2014 @ 00:24
    Charles
    0

    How to output HTML from a usercontrol tied to a property from Umbraco?

    Basically, I have a usercontrol that needs to output user-defined HTML, this is a property of a Document Type in Umbraco. The HTML gets put on the page, but in a section of the page. Basically, I am wondering on how to get the HTML to be outputted onto the page without the use of a Literal Control. Basically, the Literal Control slows down the whole site, and when using it to output over 1,000 lines of HTML, it also breaks the entire site from working altogether for about 5 minutes as I suppose it uses up too much System Resources and maxes out. What is the preferred way to output a Property from a Document Type in a User Control that deals with HTML? Right now I have the property set on Rich Text Editor, and using Umbraco 4.7.

    Any help is greatly appreciated.

    Thanks!!

  • Jeroen Breuer 4908 posts 12265 karma points MVP 4x admin c-trib
    Mar 25, 2014 @ 06:45
    Jeroen Breuer
    0

    Hello,

    Usually a literal control should work fine. Don't really know what it's so slow now.

    You could try to use a Razor Partial View Macro. In there you can output the HTML like this:

    @Html.Raw(Model.Content.GetPropertyValue<string>("propertyAlias"))

    @(Model.Content.GetPropertyValue<HtmlString>("propertyAlias"))

    Jeroen

Please Sign in or register to post replies

Write your reply to:

Draft