c# return partial views and viewmodel code example

Example: c# mvc return partial view

// Create a container for your data
//You can call your method using ajax: $.ajax({ type: "POST", url: '/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("", myModel); }

Tags:

Misc Example