render action return partial view mvc c# code example
Example: c# mvc return partial view
// Create a container for your data
<div id="ViewHolder"><div>
//You can call your method using ajax:
$.ajax({
type: "POST",
url: '<Your path to your controller>/GetView',
contentType: "application/text; charset=utf-8",
dataType: "text",
async: false,
success: function (data) {
// Populate your container
$('ViewHolder').html(data);
}
})
// In your controller
public PartialViewResult GetView()
{
//Passing a model is optional
MyModel myModel = new MyMyodel();
return PartialView("<Your View Name>", myModel);
}