Copied to clipboard

Flag this post as spam?

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


  • Linx 98 posts 258 karma points
    Apr 05, 2023 @ 19:05
    Linx
    0

    How to pass value from one page to another in Umbraco

    Hi

    I have 2 document types.

    ListOfProducts and ProductItem

    List of products has the following entries:

    Category

    Enabled

    ProductItem (Nested element so I can add multiple items for one category)

    ProductItem (This is the same property under ListOfProducts and is a nested type)

    SKU

    Title

    Description

    InStock

    I have two templates one for the productList and the other for the item.

    I load the product list template with the products and items assigned with the category. All is showing and store all the values in a variable.

    For the items (which are stored in the ProductItem nested list I store it in a var value and can see number of Product items for each category (remember they are nested content items in Umbraco world) that I stored within the productList document type.

    How can I pass the single item from the ProductList page to the other productItem template (trying to list the product detail) as when I search for the nested items (productItem) on the item page the value is null and only want one product item to display?

    Both pages are of UmbracoViewPage

    I have tried

    @Html.PartialAsync("Path to partial", Model, new ViewDataDictionary(ViewData) { { "param1", param1 }, { "param2", param2}})
    

    But the properties such as Title and Description (from the nested list items I have in a variable on the product list page) are empty when I pass in the list or use Model.Value("Title") in my partial view to display an item or can't be converted to the correct model.

Please Sign in or register to post replies

Write your reply to:

Draft