Skip to the content

How to Create and Render a partial view to a Template in Umbraco 8

Before starting this you need to be sure you already have a Doc Type and Template created in Umbraco what you would like to add your partial view to. Link to my blog on how to do this if you don't know how: https://www.umbrajobs.com/blog/posts/2020/july/how-to-create-a-new-doc-typetemplate-and-page-in-umbraco-8/

 

Right so now you've got your Doc Type and Template ready you can now create a Partial View what you would like to add to your Template.

Step 1. Log in to your Umbraco 8 back office. 

Step 2. Click Settings and scroll down to Templating, Then Right click on Partial Views(or click the 3 dots to the right of the text when you hover). and then click "New Empty Partial View". 

Step 3. Now Populate with your Partial View with what ever code you would like. and Click "Save and Publish".

Step 4. Next you need to render your new partial view to your Template (This can be done 2 ways). Go to the template you would like to edit either in Umbraco 8 back office of in your Visual Studio files and type the following code where you would like your Partial View Displayed. 

@Html.Partial("YOURpartialVIEW")
/*This is the Quick Easy Method*/
@Html.Partial("~/Views/Partials/YOURpartialVIEW.cshtml")
/*This is the Best Method for Big Project Developers*/

Step 5. Now save all your work and reload your site. If you followed each Step correctly you should now have your partial View Rendered to your site.

About the author

Nathan Reece

.Net MVC Developer | Umbraco Novice

Hey Guys,

I'm an New Developer with a passion for coding. I absolutely love working with Umbraco CMS and appreciate the Umbraco community even more.

I've got 3 years+ .Net experience and 5 years+ experience working in the Web Develepment industry, both coding and marketing job websites. I wanted to use my skills to help give something back to this awesome community and UmbraJobs.com seems like the right place to do just that.

Follow me on social media

If you're an Umbraco professional, partner, employer, recruiter or a passionate Umbraco community builder then I'm more than happy to hear from you. Follow me on my social media channels and please reach out if you have any needs, want help or consultation with anything Umbraco related or just want a general chat.

comments powered by Disqus

Blog Filter


How we can help?

Need help with an Umbraco project?

Need help with a project but not too sure who to approach? Send us your project brief and budget. We will provide a free consultation and can help you gather quotes from the best and most suitable freelancers or agencies.

Looking to hire an Umbraco Professional?

Have you got job vacancy and want to hire an Umbraco professional? Post a job on our website for free. Alternatively let us know your requirements and we will send suitable prospects your way.

Claim your free profile!

Are you an Umbraco Freelance Developer or Umbraco partner that wants to advertise on our site? If you work with Umbraco or registered as an Umbraco partner then you can create a profile for free.

Let's build the Umbraco Community

We're big on building the Umbraco community and we think you guys are awesome! If there's anyway at all we can help then please reach out.