I\'m trying to get a partial view to render using Razor in MVC5. When I use
@{ Html.RenderPartial(\"ViewName\", model); }
I get the parser erro
You haven't posted the context of that code, but that error only really happens when you're using @
directly within a code block without any HTML wrappings. For example:
@if (true) {
@{ Html.RenderPartial(...); }
}
Would give you the error, while:
@if (true) {
@{ Html.RenderPartial(...); }
}
Would be fine. You could also solve it by just removing the code block for Html.RenderPartial
entirely, including the @
:
@if (true) {
Html.RenderPartial(...);
}