Copied to clipboard

Flag this post as spam?

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


  • Nicolas Erlijman 5 posts 74 karma points
    26 days ago
    Nicolas Erlijman
    0

    Use a partial view inside master template

    My master template is called master.cshtml. Inside it, I have the typical header, body, etc layout.

    Inside the body, I want to call a partialView to add some header content in a more refactored way (not everything on master.cshtml)

    Master.cshtml

    @inherits Umbraco.Web.Mvc.UmbracoViewPage
    @using Umbraco.Web;
    ...
    @Html.Partial("MasterLayout/Header/_OpenGraph");
    ...
    

    I don't know what to put in the _OpenGraph partial as model...

    _OpenGraph.cshtml

    @model XXXX
    

    I am using modelsBuilder.

  • Alex Skrypnyk 5730 posts 21691 karma points MVP 3x admin c-trib
    26 days ago
    Alex Skrypnyk
    0

    Hi Nicolas,

    Just remove this line -

    @model XXXX
    

    Use this first line for all partial views -

    @inherits UmbracoViewPage
    

    Thanks,

    Alex

Please Sign in or register to post replies

Write your reply to:

Draft