Copied to clipboard

Flag this post as spam?

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

  • Sonja 132 posts 620 karma points
    Nov 16, 2018 @ 07:53


    How do I get Current Page in partial view? I wouldn't like to loop thru Model.Content.Site because I want to avoid loop. I've tried

    var page1 = Umbraco.Content(CurrentPage);

    but I'm not getting nothing. Please advice

  • Alex Skrypnyk 5733 posts 21696 karma points MVP 4x admin c-trib
    Nov 16, 2018 @ 08:29
    Alex Skrypnyk

    Hi Sonja

    "Umbraco.AssignedContentItem" is a current Umbraco Page. So use just :

    var page1 =  Umbraco.AssignedContentItem;


  • Dave Woestenborghs 3227 posts 10923 karma points MVP 5x admin c-trib
    Nov 16, 2018 @ 10:16
    Dave Woestenborghs

    Depends on what kind of view type you are using

    If your template inherits from UmbracoViewPage than @Model is your current item.

    If your template inherits from UmbracoTemplatePage than @Model.Content is your current item

    But if you use a custom model eg. UmbracoViewPage

    If you are interested in what the difference is between UmbracoViewPage and UmbracoTemplatePage you can read this article :

    Be aware that in V8 UmbracoTemplatePage does not exist anymore so it's better to use UmbracoViewPage

    Personally I also use ModelsBuilder to create strongly typed object representing my documenttypes.

    You can read more about that here ;

    If you have more questions just let us know


Please Sign in or register to post replies

Write your reply to: