Copied to clipboard

Flag this post as spam?

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


  • Ismael 71 posts 354 karma points
    Nov 06, 2015 @ 01:38
    Ismael
    0

    Not working with Nested Content

    Hi,

    Not sure if this is a question for the Nested Content guys for OEmbed, but I have an OEmbed property on a doctype i'm using for Nested Content but the oembed property returns an empty string when using:

    @sectionContent.GetPropertyValue<MvcHtmlString>("video")
    

    Where @sectionContent is my Nested Content property.

    The property type returned seems to be:

    Our.Umbraco.NestedContent.Models.DetachedPublishedProperty
    

    EDIT: Umbraco 7.3

    Cheers Ismael.

  • Dave Woestenborghs 3504 posts 12135 karma points MVP 9x admin c-trib
    Nov 06, 2015 @ 07:52
    Dave Woestenborghs
    0

    Hi Ismael,

    Thanks for reporting. Let me reproduce this and i will get back to you.

    Dave

  • Dave Woestenborghs 3504 posts 12135 karma points MVP 9x admin c-trib
    Nov 06, 2015 @ 08:28
    Dave Woestenborghs
    0

    Hi Ismael,

    I tried to reproduce this but I ran in to other problems.

    When I use

    @sectionContent.GetPropertyValue<MvcHtmlString>("video") 
    

    i get a runtime error. But when I use

    @sectionContent.GetPropertyValue("video") 
    

    it works just fine for me.

    Here is my entire code :

    @using Umbraco.Web
    @inherits Umbraco.Web.Mvc.UmbracoTemplatePage
    @{
        Layout = "Master.cshtml";
        var sections = Model.Content.GetPropertyValue<IEnumerable<IPublishedContent>>("nestedVideo").ToList();
    }
    
    
    <div>
        @foreach(var sectionContent in sections)
        {
            <h2>@sectionContent.GetPropertyValue("title")</h2>  
            <div>       
                @sectionContent.GetPropertyValue("video")
            </div>
        }
    </div>
    

    Strangest thing is that when I do :

    @sectionContent.GetPropertyValue<string>("title")
    

    I get a runtime error as well.

    So i think it is a Nested Content issue and it is better to report it there.

  • Dave Woestenborghs 3504 posts 12135 karma points MVP 9x admin c-trib
    Nov 06, 2015 @ 08:32
    Dave Woestenborghs
    0

    Hi Ismael,

    I just refactored my example yet and for me it works now.

    @using Umbraco.Web
    @inherits Umbraco.Web.Mvc.UmbracoTemplatePage
    @{
        Layout = "Master.cshtml";
        var sections = Model.Content.GetPropertyValue<IEnumerable<IPublishedContent>>("nestedVideo").ToList();      
    }
    
    
    <div>
        @foreach(var sectionContent in sections)
        {
            var nestedVideo = sectionContent.GetPropertyValue<MvcHtmlString>("video");
            <h2>@sectionContent.GetPropertyValue("title")</h2>  
            <div>           
                @nestedVideo
            </div>
        }
    </div>
    

    Can you post some more details about your configuration and code to render it ?

  • Ismael 71 posts 354 karma points
    Nov 08, 2015 @ 18:08
    Ismael
    0

    Hi Dave,

    This is essentially what I have:

    Data type called "video_picker" of type OEmbed Picker

    Doctype named "VideoSection" with a property of "video" of type video_picker

    Data Type called ncvideosection of type Nested Content. Doc Types set to VideoSection, min/max both set to 1

    Doctype named "Home" with a property called videoSection of type ncvideosection

    On my Home template I have the following

    var section = Model.Content.GetPropertyValue<IPublishedContent>("videoSection")
    
    <div class="video">
    @section.GetPropertyValue<MvcHtmlString>("video")
    </div>
    

    It looks very similar to what you have, maybe I'm missing a reference somewhere, although I never received any runtime errors as you did.

    Thanks.

  • Ismael 71 posts 354 karma points
    Nov 08, 2015 @ 18:17
    Ismael
    100

    Ok - just tried again and now it works... sigh

    Not sure exactly what happened, possibly a cache thing, I restarted my machine and also republished the site and now the video appears.

    Cheers Ismael.

Please Sign in or register to post replies

Write your reply to:

Draft