Editing for clarity. When an item is selected from the drop-down list, call a method in my controller that will return a partial view and refresh the div on my page.
I have a PartialView ActionLink that I want to call every time I select a new item from the drop-down list to refresh the table on my web page - how can I do this without clicking a button?
@Html.DropDownListFor(m => m.SelectedCustomerId, Model.CustomerIDItem)
I can make Request ["selectedCustomerId"] to retrieve the value from it without any problems, but my question really concerns the dynamic part. The first idea was to connect AJAX to the drop-down list or use jQuery, but I don't know how to actually make this work.
Thanks in advance.
Change 4:
:
_ DefaultValuesView.cshtml:
@Html.DropDownListFor(m => m.SelectedCustomerId, Model.CustomerIDItem)
<div id="divValues">
@{ Html.RenderPartial("_DefaultValuesPartialView");}
</div>
DefaultValuesController.cs
[HttpPost]
public PartialViewResult DefaultValuesPartialView(string SelectedCustomerId)
{
Session["theCustomerId"] = Request["selectedCustomerId"];
var model = new DefaultValuesModel
{
CustomerIDItem = GetCustomerIds(),
FieldIDItem = GetValues(),
CurrentValuesItem = GetCurrentValues()
};
model.TriggerOnLoad = true;
this.customerId = Convert.ToInt32(Request["selectedCustomerId"]);
errorMessage = "PartialView is loaded!";
model.TriggerOnLoadMessage = errorMessage;
return PartialView("_DefaultValuesPartialView", model);
}