Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
Hi There,
I'm new to v5 and razor. I'm wanting to load partial views based on page name. However I'm not sure what the best approach for this is?
I would like to pass this view into the body of the document.
@Html.RenderPartial(/mypath/mpartialview);
Any ideas how I can do this?
Sean
Solved it myself.
var currentPage = @DynamicModel; var rootNode = currentPage.AncestorsOrSelf.Last(); var theCurrentPageName = @String.Format("{0}{1}{2}","~/Views/Umbraco/Partial/",@currentPage.Name,"Partial.cshtml");
is working on a reply...
Write your reply to:
Upload image
Image will be uploaded when post is submitted
rendering dynamic partial views with razor v5
Hi There,
I'm new to v5 and razor. I'm wanting to load partial views based on page name. However I'm not sure what the best approach for this is?
I would like to pass this view into the body of the document.
@Html.RenderPartial(/mypath/mpartialview);
Any ideas how I can do this?
Sean
Solved it myself.
var currentPage = @DynamicModel;
var rootNode = currentPage.AncestorsOrSelf.Last();
var theCurrentPageName = @String.Format("{0}{1}{2}","~/Views/Umbraco/Partial/",@currentPage.Name,"Partial.cshtml");
is working on a reply...