Copied to clipboard

Flag this post as spam?

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


  • ozgur 2 posts 82 karma points
    Jan 11, 2019 @ 13:29
    ozgur
    0

    i cant display iframe with razor

    hi everyone,

    this code is home.cshtml and it didn't work. in the comment line iframe it's work but I need razor to bring the data. how can i fix this problem?

    <div style="position:relative !important;">
            <!--iframe onload="resizeIframe(this)" scrolling="no" class="SliderMainExternal" src="/slider-partial/slider-part-en.html" style="overflow:hidden;width:100%;margin-top:-75px;"></iframe-->
            <iframe onload="resizeIframe(this)" scrolling="no" class="SliderMainExternal" src="@Html.Raw("/Views/slider.cshtml")" style="overflow:hidden;width:100%;margin-top:-75px;"></iframe>
    
            <a class="scroll-down" address="true"></a>
        </div>
    

    home.cshtml dependencies these

    @inherits Umbraco.Web.Mvc.UmbracoTemplatePage
    @inherits UmbracoTemplatePage
    
    @{
        Layout = null;
    }
    
  • Alex Skrypnyk 5908 posts 22603 karma points MVP 4x admin c-trib
    Jan 14, 2019 @ 16:09
    Alex Skrypnyk
    100

    Hi Ozgur

    The issue is that you do not render the view as HTML, use one of the methods described in this thread - https://stackoverflow.com/questions/483091/how-to-render-an-asp-net-mvc-view-as-a-string

    You need to render view to pass it as HTML string to an iframe.

    There is nothing with Umbraco in this problem, it's pure razor + html issue.

    Thanks, Alex

  • Alex Skrypnyk 5908 posts 22603 karma points MVP 4x admin c-trib
    Jan 23, 2019 @ 12:44
    Alex Skrypnyk
    1

    Hi Ozgur

    Did you solve the issue? Can you share with our community?

    Alex

  • ozgur 2 posts 82 karma points
    Jan 29, 2019 @ 14:44
    ozgur
    0

    Hi alex,

    Thank you very much for your help, but this structure (iframe) did not meet my wishes and I blew it up :)

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies