There is two ways of rendering a partial view on a template.
Actually this is just standard MVC so not so much Umbraco specific.
Here is an example of two ways to do it. My partial view is called TopMenu.
@Html.Partial("TopMenu")
Quick and easy way.
@Html.Partial("~/Views/Partials/TopMenu.cshtml")
Sometimes I prefer to do it like this. A little more code but with bigger projects I like to store my partial views in different folders to keep things neat. This also helps other developers when I am working in a team.
How do i render a partial View to screen in Umbraco 8?
I have created a partial view in the Umbraco back office, but i am struggling with the code on how to render it to my templates.
Can anyone help me out!?
I am using Umbraco 8, Not Sure if this makes the process any different.
Hi Nathan,
There is two ways of rendering a partial view on a template.
Actually this is just standard MVC so not so much Umbraco specific.
Here is an example of two ways to do it. My partial view is called TopMenu.
Quick and easy way.
Sometimes I prefer to do it like this. A little more code but with bigger projects I like to store my partial views in different folders to keep things neat. This also helps other developers when I am working in a team.
Hope this helps.
Regards
David
Thanks Dave, Ill test the quick and easy way now.
Cheers David, I've Got it now.
For anyone else struggling with creating and rendering Partial Views, I have Written a Blog Step by Step Tutorial on how it is done.
Here's the link: https://www.umbrajobs.com/blog/posts/2020/july/how-to-create-and-render-a-partial-view-to-a-template-in-umbraco-8/
is working on a reply...