Rendering partial views with Razor in MVC5
问题 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 error: Unexpected "{" after "@" character. Once inside the body of a code block (@if {}, @{}, etc.) you do not need to use "@{" to switch to code. When I remove the {} , i.e.: @Html.RenderPartial("ViewName", model); I get the compilation error Cannot implicitly convert type 'void' to 'object'. What am I doing wrong? 回答1: You haven't posted the context of that