return two partial views mvc code example

Example 1: 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);
}

Example 2: asp.net mvc render multiple partial views

// You can't reutrn multiple partial views.
// However you can by pass this by simply looping a action

// in your .cshtml use Razor:

@{
  	// Note! Using this method you can't pass JS variables;
	// they are loaded in runtime 
	int loopThisManyTimes = 10;
	for (int i = 0; i < loopThisManyTimes; i++)
	{
      	MyModel model = new MyModel();
		Html.RenderPartial("<Your view name>", model);	
	}
}

// Or use JQuery:

$.ajax({
    type: "POST",
    url: '<Your URL>',
    contentType: "application/text; charset=utf-8",
    dataType: "text",
    success: function (data) {
        $("<Your container id>").html(data);
    },
    error: function (errData) {
      	// An error occured!
        $("<Your container id>").html(errData);
    }
});