Hi - I have a partial view to render an IPublishedElement model, but also need to show content from the current page (IPublishedContent). Can i obtain the current IPC from the DI container?
this is what i tried but it doesn't work:
@inject UmbracoHelper UmbracoHelper
@{
var ipc = UmbracoHelper.AssignedContentItem;
}
inject AssignedContentItem into partial view?
Hi - I have a partial view to render an IPublishedElement model, but also need to show content from the current page (IPublishedContent). Can i obtain the current IPC from the DI container?
this is what i tried but it doesn't work:
thanks
so i managed to find this technique which seems to give me what im after:
But still keen to hear thoughts on if this is an antipattern/bad practice and why, or if there is a better way.
Thanks :D
is working on a reply...