I have a dropdown list in an MVC view. On selection change of dropdown list I want to call specific action method in the controller.
What I have done on view is this :>
@Shimmy is there a way to do this as a one-liner, without defining the function in js?
yes you can and here is the code for that:
@Html.DropDownListFor(m => m.Name, new SelectList((System.Collections.IEnumerable)ViewBag.DropDownName, "Value", "Text"), new { @class = "form-control", onchange = "document.location.href = '/Home/Employee?c=' + this.options[this.selectedIndex].value;" })