0

I want to embed other cshtml views into my main view. After doing some research I found that Html.RenderPartial can be used for this purpose. But I'm not seeing RenderPartial and only getting RenderPartialExtensions.

I'm using System.Web version 4.0.0.0 and VS2017. Also, installed Microsoft.AspNet.Mvc v5.2.5 but that didn't help either.

If its not possible, can you give an example of how to use RenderPartialExtenstions in cshtml?

aa100
  • 31
  • 1
  • 4

1 Answers1

0

RenderPartialExtensions adds the RenderPartial extension method to the HtmlHelper class (which is named "Html" in ASP.NET MVC views), so using RenderPartial is using RenderPartialExtensions by definition.

Here's a typical use of RenderPartial:

@{
    Html.RenderPartial("~/Views/Shared/_MyPartialView.cshtml");
}
Micah
  • 421
  • 1
  • 5
  • 11
  • I get the error that 'Html' does not exist in the current context. I've ensured to add references to System.Web.Mvc. I am able to use RenderPartialExtensions. Can you tell me how to use RenderPartialExtensions? – aa100 May 14 '18 at 17:36