how to call partial view in mvc code example
Example 1: asp net core mvc partial view
<partial name="_PartialName" />
Example 2: mvc c# return renderPartial
<div id="ViewHolder"><div>
$.ajax({
type: "POST",
url: '<Your path to your controller>/GetView',
contentType: "application/text; charset=utf-8",
dataType: "text",
async: false,
success: function (data) {
$('ViewHolder').html(data);
}
})
public PartialViewResult GetView()
{
MyModel myModel = new MyMyodel();
return PartialView("<Your View Name>", myModel);
}
Example 3: partial MVC
<partial name="ThenName" model="object" />