@Html.DropDownListFor(model => model.SelectedOption, new SelectList(ViewBag.Options, "Value", "Text"), "Select an Option", new { @class = "form-control" })
public ActionResult Index()
{
var options = new List
private IQueryable
$("#SelectedOption").on("change", function () { var selectedOption = $('#SelectedOption').val(); $.ajax({ url: "/Home/GetData", data: { selectedOption: selectedOption }, success: function (result) { // update the UI with filtered data } }); });
public JsonResult GetData(string selectedOption) { var filteredItems = GetFilteredItems(selectedOption).ToList(); return Json(filteredItems, JsonRequestBehavior.AllowGet); }
success: function (result) { var html = ''; $.each(result, function (key, item) { html += '