Hi I am trying to refresh partial view with multiple parameters. I have got it to work with one parameter. How can I get it to work with more than one parameters. Here is the code, I have got so far. VIEW
@{
ViewBag.Title = "Report";
Layout = "~/Views/Shared/_Layout.cshtml";
}
<script type="text/javascript">
$(document).ready(function () {
$("#serviceLine").change(function () {
var url = "/Home/PartialView1?serviceLine=" + $(this).val();
alert(url);
$("#reportContent").load(url);
});
$("#ClientID").change(function(){
var url = "/Home/PartialView1?ClientID=" + $(this).val();
alert(url);
$("#reportContent").load(url);
});
});
</script>
<h3>Report</h3>
<div>
<table>
<tr>
<td>Client</td>
<td>@Html.DropDownList("ClientList", null, new {id = "ClientID"})</td>
<td>ServiceLine</td>
<td>@Html.DropDownList("ServiceLine", null, new {id="serviceLine"}) </td>
</td>
</tr>
</table>
</div>
<div>
<h2>List</h2>
<div id="reportContent">
@Html.Action("PartialView1", new { clientID = 0, serviceLine = "_" })
</div>
</div>
CONTROLLER
public ActionResult PartialView1(int clientID, char serviceLine)
{
//Login
return PartialView();
}
ANY SUGGESTIONS PLEASE?
You could try this:
Just put all of the parameters in the data property.
You can use a jQuery ajax method and populate the results from the
success
method. Something like: