Friday, 10 October 2014

How to render partial view from different folder?

The usual syntax to render a partial view is

@Html.Partial("partialViewName")

This syntax expects the partial view to be physically present in the current folder or in the "Shared" folder.

If you want to use a partial view which is not in "Shared" but in a different "Views" folder then use below Razor syntax.

@Html.Partial("~/Views/AnotherFolder/_partialView.cshtml")

No comments:

Post a Comment