To return a Partial view from the controller action method, we can write return type as PartialViewResult
and return using PartialView
method.
public PartialViewResult OutputPartialView() { return PartialView("_GetFileName"); // returns view with model }
In the above code, we are assuming that _GetFileName.cshtml exists in the controller specific folder otherwise we need to specify the complete file name of the view from the root of the application (like "~/Views/PersonalDetails/_ViewName").
Views: 70664 | Post Order: 52