Copied to clipboard

Flag this post as spam?

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


  • bob baty-barr 1180 posts 1294 karma points MVP
    Oct 25, 2018 @ 21:32
    bob baty-barr
    0

    how to use in a partial?

    does anyone have an example of a partial view usage of this... sorry for being thick, but i just cannot figure this thing out.

    to add some context, i am trying to loop through nodes iPublished content, and display an icon with some other node details... typically i would just use item.GetPropertyValue("eventIcon") but that gives me a newton error... sorry, for being thick.

    thanks in advance.

  • Mario Lopez 168 posts 958 karma points MVP 4x c-trib
    Oct 26, 2018 @ 02:52
    Mario Lopez
    0

    Which version are you using? In 1.6 we released a fix for some json issues.

    UPDATE: I just tried this with that version and it works ok:

    Products.cshtml

    foreach (Product product in Model.Content.FeaturedProducts)
     {
           @Html.Partial("~/Views/Partials/_Product.cshtml", product)
     }
    

    _Product.cshtml

    @inherits UmbracoViewPage<Product>
    
    @Model.GetPropertyValue("icon")
    
Please Sign in or register to post replies

Write your reply to:

Draft