Copied to clipboard

Flag this post as spam?

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


  • Nadine Fisch 159 posts 429 karma points
    Jan 12, 2018 @ 13:29
    Nadine Fisch
    0

    Need access to properties of a dynamicPublishedContent-Item in my helpermethod

    Hi,

    I loop over a "list" of node-objects in UmbracoTemplatePage. I thought the items are type of "Umbraco.Web.Models.DynamicPublishedContent", because it is the result of the output-variable:

    @item
    

    I need a helper-Method for the object "item" to create a read more-link. I pass the param DynamicPublishedContent.

    @helper GetReadMoreLink(DynamicPublishedContent node) {}
    

    and added the namespace

    @using Umbraco.Web;
    

    But if I call the method I am not able to get the property of the object

    @Helpers.GetReadMoreLink(item);
    

    I got this error

    The type or namespace name 'DynamicPublishedContent' could not be found (are you missing a using directive or an assembly reference?)
    

    My aim is to get the properties of the page-item via the helpermethod. Can you please help me?

  • Alex Skrypnyk 6150 posts 24110 karma points MVP 8x admin c-trib
    Jan 12, 2018 @ 13:30
    Alex Skrypnyk
    101

    Hi Nadine

    Try to use:

    @helper GetReadMoreLink(dynamic node) {}
    
  • Nadine Fisch 159 posts 429 karma points
    Jan 12, 2018 @ 13:40
    Nadine Fisch
    0

    Thank you!

  • Alex Skrypnyk 6150 posts 24110 karma points MVP 8x admin c-trib
    Jan 12, 2018 @ 13:41
    Alex Skrypnyk
    0

    You are welcome, Nadine, have a great weekend!

Please Sign in or register to post replies

Write your reply to:

Draft