Copied to clipboard

Flag this post as spam?

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


  • Jim 26 posts 86 karma points
    Sep 30, 2015 @ 14:02
    Jim
    0

    Passing a list of nodes as a parameter to a Partial View

    Hi

    I have a partial view that displays a gallery of thumbnails associated with a list of pages of type 'destinationPage'. I want to be able to filter this list before passing it to the partial view.

    Here is the code I am using to create the list (it is working fine):-

    var itineraryIdeaNodes = Umbraco.TypedContentAtXPath("//itineraryPage");
    
    itineraryIdeaNodes = itineraryIdeaNodes.Where(y => 
        Umbraco.TypedContent(
            y.GetPropertyValue<string>("destinationItinerary").Split(',')
                            ).Where(x => x.Id == @CurrentPage.Id).Count() > 0).
        Take(10);
    

    I have tried adding the itineraryIdeaNodes object to the code that refers to the partial view:-

    @Html.Partial("ItineraryIdeasView", itineraryIdeaNodes)
    

    However, I cannot discover what type

    @inherits Umbraco.Web.Mvc.UmbracoTemplatePage<T?>
    

    Nor can I work out how to access the parameter within the partial view.

    Have I got this hopelessly wrong?

    Thanks in advance.

    Jim

  • 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