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...
This forum is in read-only mode while we transition to the new forum.
You can continue this topic on the new forum by tapping the "Continue discussion" link below.
Continue discussion
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...
This forum is in read-only mode while we transition to the new forum.
You can continue this topic on the new forum by tapping the "Continue discussion" link below.