Copied to clipboard

Flag this post as spam?

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


  • Chriztian Steinmeier 2765 posts 8571 karma points MVP 6x admin c-trib
    1 week ago
    Chriztian Steinmeier
    0

    How do I handle Content from a PublishedContentWrapped viewmodel?

    Hi friends 👋

    I've got this (simplified) setup:

    • All document types have a "Meta" composition
    • The MainLayout calls a "MetaTags" partial that takes an <IMeta> model
    • The SearchPage template takes a <SearchViewModel> which is created as a PublishedContentWrapped from a SearchPageController.

    My problem is that when the MetaTags partial runs on the SearchPage, it throws the "Cannot bind SearchViewModel to IMeta" error...

    What's the correct way to solve this?

    /Chriztian

  • Chriztian Steinmeier 2765 posts 8571 karma points MVP 6x admin c-trib
    1 week ago
    Chriztian Steinmeier
    100

    Found something in the docs where this scenario is mentioned. I'm not sure I understand all of the three options for solving it though... but I've made my Meta partial inherit from the generic UmbracoViewPage now, and used the (less than optimal) Value() syntax instead - atleast it works now.

Please Sign in or register to post replies

Write your reply to:

Draft