Copied to clipboard

Flag this post as spam?

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


  • pubudu 30 posts 133 karma points
    Apr 09, 2019 @ 09:18
    pubudu
    0

    Dynamic Navigation Menu in Umbraco CMS

    enter image description here

    Why occur this error??

  • Darren Welch 23 posts 136 karma points c-trib
    Apr 09, 2019 @ 09:27
    Darren Welch
    0

    try

    .Children().Where("Visible");
    
  • pubudu 30 posts 133 karma points
    Apr 10, 2019 @ 03:31
    pubudu
    0

    Thanks Darren. But that is not worked.finally i pass that without filtering

  • Nik 1614 posts 7260 karma points MVP 7x c-trib
    Apr 09, 2019 @ 10:39
    Nik
    0

    Hi Pubudu,

    It looks like you are trying to use dynamics in your screen shot. I can't be sure though as it's partly hidden.

    But, Umbraco 8 doesn't have support for dynamics and as such you should look to re-write the code using strongly typed objects. I would suggest changing your GetSubNavigationList method to have a signature similar to the following:

    public List<NavigationList> GetSubNavigationList(IPublishedContent page)
    

    (note: I'm assuming that IPublishedContent is the correct interface but I can't remember if that changed in Umbraco V8 to have a different name).

    Nik

  • pubudu 30 posts 133 karma points
    Apr 10, 2019 @ 03:33
    pubudu
    0

    Thanks Nik. enter image description herefinally i pass that without filtering

  • Nik 1614 posts 7260 karma points MVP 7x c-trib
    Apr 10, 2019 @ 08:19
    Nik
    0

    Hi pubudu,

    You are still using dynamic objects. It is recommended you don't do this. The children of IPublishedContent are IPublishedContent so you'd be better off having strongly typed all the way though your code.

    That will mean in order to access properties you'll have to use GetPropertyValue though :-)

    Nik

Please Sign in or register to post replies

Write your reply to:

Draft