Copied to clipboard

Flag this post as spam?

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


  • jeff mayer 122 posts 200 karma points
    Jun 30, 2014 @ 20:34
    jeff mayer
    0

    Getting Error retrieving Any Data from MNTP

     

    Getting error on any field other name when using MNTP and the Umbraco Core Property Value Converters.

    Using

    var typedMultiNodeTreePicker = Model.Content.GetPropertyValue<IEnumerable<IPublishedContent>>("resourcespicker");

     

     

    Exception: System.Web.HttpCompileException (0x80004005): c:\inetpub\dev\dev-advisors-new.mysite.com\Views\MacroPartials\GetInfo.cshtml(33): error CS1061: 'Umbraco.Core.Models.IPublishedContent' does not contain a definition for 'mDescription' and no extension method 'mDescription' accepting a first argument of type 'Umbraco.Core.Models.IPublishedContent' could be found (are you missing a using directive or an assembly reference?)

     

    Any thoughts

  • Jeavon Leopold 3072 posts 13628 karma points MVP 10x admin c-trib
    Jun 30, 2014 @ 20:44
    Jeavon Leopold
    0

    Hi Jeff,

    Could you please post how you are getting 'mDescription' and also which version of the value converters you are using?

    Thanks,

    Jeavon

  • jeff mayer 122 posts 200 karma points
    Jun 30, 2014 @ 20:48
    jeff mayer
    0

    Using 2.05. I just uninstalled the 2.0 beta and installed 2.05.  "mDescription" is a rich text field. 

    Here's my basic loop 

     foreach (var item in typedMultiNodeTreePicker)

        {

     

    @item.mDescription

       } 

     

     

  • Jeavon Leopold 3072 posts 13628 karma points MVP 10x admin c-trib
    Jun 30, 2014 @ 20:56
    Jeavon Leopold
    1

    Ah cool, to access a property like that you need to use dynamics, so

    @{
        var dynamicMultiNodeTreePicker = CurrentPage.resourcesPicker;
        foreach (var item in dynamicMultiNodeTreePicker)
        {
            <p>Name: @item.Name</p>
            if (item.HasValue("mDescription"))
            {
                <p>Title: @item.mDescription</p>
            }
        }
    }     
    

    There is a dynamics example on each page of documentation after the typed one e.g. Multinode picker

    Hope that works?

    Jeavon

  • Jeavon Leopold 3072 posts 13628 karma points MVP 10x admin c-trib
    Jul 03, 2014 @ 09:18
    Jeavon Leopold
    0

    Hey Jeff, did the above work for you?

    Jeavon

  • jeff mayer 122 posts 200 karma points
    Jul 07, 2014 @ 19:59
    jeff mayer
    0

    Yes it did, thank you for the info. 

  • Jeavon Leopold 3072 posts 13628 karma points MVP 10x admin c-trib
    Jul 07, 2014 @ 20:13
    Jeavon Leopold
    0

    Great! Could you please mark the correct solution using the green tick?

Please Sign in or register to post replies

Write your reply to:

Draft