Copied to clipboard

Flag this post as spam?

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


  • Lars 66 posts 136 karma points
    Oct 15, 2015 @ 09:35
    Lars
    0

    Insert code from the Umbraco content section

    Hi. I want my user to be able to insert html code for an iframe like the code below. It seems that neither the Richtext editor nor the Textstring datatype is able to insert the code properly.

    Is there some other method for this avoiding the hardcoding of the iframe code?

    The iframe code could be like this:

     <iframe src="demo_iframe.htm" width="200" height="200"></iframe>
    

    Suggestions are welcome since my deadline is approaching :-)

    Regard, Lars

  • Dennis Aaen 4500 posts 18255 karma points admin hq c-trib
    Oct 15, 2015 @ 10:16
    Dennis Aaen
    0

    Hi Lars,

    What I normally to is to use the multiple texts for scrips, then what you need to do when you output this in one of your templates, or in a partial view or partial view macro file is to use the @Html.Raw method.

    You can do something like this,

    @Html.Raw(CurrentPage.PropertyAlias)
    

    Where the property alias is the alias of the field with the iframe.

    We also have a video about the method, on Umbraco TV https://umbraco.tv/videos/umbraco-v7/implementor/working-with-umbraco-data/razor-syntax/htmlraw/documentation/

    Hope this helps,

    /Dennis

  • Lars 66 posts 136 karma points
    Oct 15, 2015 @ 10:41
    Lars
    0

    Thank you for a quick reply, Dennis. I will give it a try later on but it looks as if this is the way to do it and then I will write in the forum what the results are.

    //Lars

  • Lars-Erik Aabech 349 posts 1100 karma points MVP 8x c-trib
    Oct 15, 2015 @ 11:33
    Lars-Erik Aabech
    0

    Hi guys,

    In case you want the editor to create more or less the same markup every time, you could also benefit from making it into a macro.

  • Lars 66 posts 136 karma points
    Oct 18, 2015 @ 12:30
    Lars
    0

    Hi Both

    With a textstring type and html.raw it works fine now. Thank you very much both of you for helping me.

    //Lars

Please Sign in or register to post replies

Write your reply to:

Draft