Such a situation I write a site on Asp.net MVC 5 is a form of creating an animal, there are two Select in one type of animal and in the second breed. Well, you need to implement so that when you change the first one, the second one loads in the second one. This is how I set these Selects by default.
<div class="form-group"> @Html.LabelFor(model => model.Type, htmlAttributes: new { @class = "control-label col-md-2" }) <div class="col-md-10"> @Html.DropDownListFor(model => model.Type, ViewBag.type as SelectList) @Html.ValidationMessageFor(model => model.Type, "", new { @class = "text-danger" }) </div> </div> <div class="form-group"> @Html.LabelFor(model => model.Species, htmlAttributes: new { @class = "control-label col-md-2" }) <div class="col-md-10"> @Html.DropDownListFor(model => model.Species, ViewBag.species as SelectList) @Html.ValidationMessageFor(model => model.Species, "", new { @class = "text-danger" }) </div> </div>
As I understand it, you need to do this either in jQuery, or in AJAX. But I do not know how to do it. Help please