I have a partial view with a custom model and was wondering which of the following ways is the most efficient way of getting the current page information:
Make my custom model inherit the 'RenderModel'
Use UmbracoContext directly in the partial to get node with Umbraco.TypedContent
If you make your partial view inherit UmbracoViewPage + your custom model in the following way
@inherits UmbracoViewPage
Then you'll have access to all the usual Umbraco Helper methods via @Umbraco in your partial view, and also, therefore, the currently assigned content page!:
Best way to get current page info in partial view
Hi,
I have a partial view with a custom model and was wondering which of the following ways is the most efficient way of getting the current page information:
Thanks in advance for your help.
Hi Ben
If you make your partial view inherit UmbracoViewPage + your custom model in the following way
@inherits UmbracoViewPage
Then you'll have access to all the usual Umbraco Helper methods via @Umbraco in your partial view, and also, therefore, the currently assigned content page!:
var currentPage = Umbraco.AssignedContentItem;
If that is what you are after?
regards
Marc
is working on a reply...