I'm wondering how can I render a partial view to be used in a JsonResult in my controller?
return Json(new
{
Html = this.RenderPartialView("_EditMovie", updatedMovie),
Message = message
}, JsonRequestBehavior.AllowGet);
}
I'm wondering how can I render a partial view to be used in a JsonResult in my controller?
return Json(new
{
Html = this.RenderPartialView("_EditMovie", updatedMovie),
Message = message
}, JsonRequestBehavior.AllowGet);
}
RenderPartialView
is a custom extension method which renders a view as astring
.It wasn't mentioned in the article (what you have referred originally) but you find it in the sample code attached to the article. It can be found under the \Helpers\Reders.cs
Here is code of the method in question: