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 14 posts 104 karma points
    Apr 30, 2020 @ 21:51
    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 6175 posts 24186 karma points MVP 8x admin c-trib
    Apr 30, 2020 @ 21:52
    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