Copied to clipboard

Flag this post as spam?

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


  • Nso 18 posts 87 karma points
    Jul 12, 2018 @ 11:35
  • Rune Hem Strand 145 posts 898 karma points admin hq c-trib
    Jul 12, 2018 @ 13:13
    Rune Hem Strand
    2

    Hi Nso,

    it looks like you have two models passed as the page model to the same view. The error message states that you're trying to use both CsapatElem and Masterpage and the page model can only be one of these.

    This is usually due to template inheritance (look at the top of your templates), where two templates use different models. Typically you want your Masterpage to be generic (which means it can use any model and then your document type specific template to have a strong model declaration.

    So, if I'm guessing correctly you want the beginning of your templates to look like this:

    Masterpage.cshtml:

    @inherits UmbracoTemplatePage
    @{
        Layout = null;
    }
    

    CsapatElem.cshtml:

    @inherits Umbraco.Web.Mvc.UmbracoTemplatePage<ContentModels.CsapatElem>
    @using ContentModels = Umbraco.Web.PublishedContentModels;
    @{
        Layout = "masterpage.cshtml";
    }
    

    With the above your masterpage will work with all child templates and the child template has strongly typed page model. I have no idea if that is actually the name of your templates but hope it makes sense ☺

    All the best
    Rune

  • Nso 18 posts 87 karma points
    Jul 16, 2018 @ 07:08
    Nso
    0

    Thanks!

Please Sign in or register to post replies

Write your reply to:

Draft