razor partial view from controller code example
Example 1: asp net core mvc partial view
<partial name="_PartialName" />
Example 2: c# mvc return partial view
<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);
}