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 428 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 5908 posts 22603 karma points MVP 4x admin c-trib
    Jan 12, 2018 @ 13:30
    Alex Skrypnyk
    101

    Hi Nadine

    Try to use:

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

    Thank you!

  • Alex Skrypnyk 5908 posts 22603 karma points MVP 4x admin c-trib
    Jan 12, 2018 @ 13:41
    Alex Skrypnyk
    0

    You are welcome, Nadine, have a great weekend!

  • 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