Copied to clipboard

Flag this post as spam?

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


  • adam 14 posts 74 karma points
    Apr 07, 2013 @ 01:50
    adam
    0

    Displaying iframe with razor

    Im having a bit of trouble displaying an iframe using razor

    I have set this up so that in umbraco I paste the iframe link into a multiple textfield, and if I was doing this in an  XSLT I would do something like:

      <xsl:value-of select="embedCode" disable-output-escaping="yes"/>

    Which would display the video fine, but I am now trying to do this in razor and I can't seem to get it to display at all? Should I use html raw? I tried but couldnt get it working

    This is basically what I have at the moment which just spits out the iframe url

     <div>@item.embedCode</div>

    Anyone have any ideas please?

    Cheers

  • Michael Wulff Nielsen 11 posts 74 karma points
    Apr 07, 2013 @ 10:11
    Michael Wulff Nielsen
    100

    Try this:

    @Html.Raw(item.embedCode)
  • Charles Afford 1163 posts 1709 karma points
    Apr 07, 2013 @ 11:32
    Charles Afford
    0
  • adam 14 posts 74 karma points
    Apr 07, 2013 @ 16:43
    adam
    0

    Brilliant thank you!

  • Aidan Phelan 1 post 21 karma points
    May 27, 2013 @ 09:52
    Aidan Phelan
    0

    Hey guys, I'm seeing the exact same issue but @Html.Raw(...) isn't working. Essentially I have a multiple textfield set up, which stores an iframe value for an embedded youtube video. If I add any iframe code into this textfield, the value stored in it gets ignored and nothing gets displayed at all, whereas if I enter a normal text value into the textfield, this gets output when I call the property.

    I would have thought @html.raw would fix it but it isn't working.

     

    I'm working with v 6.0.3.

     

    Any help would be massively appreciated!

     

    Edit: just to test, I added some text in between iframe tags, e,g, <iframe src='...'>test</iframe> and the text "test" renders fine while the iframe tags get stripped.

Please Sign in or register to post replies

Write your reply to:

Draft