MVC Dropdownliste, onchange [geschlossen]

Ich habe eine Dropdownliste für 2 in HTML, Dropdownliste für Land und Dropdownliste für Staat. Wenn ich MVC verwende, möchte ich die Ausgabe wie folgt sein. Wenn ich das ausgewählte Land ändere, wird der Zustand des ausgewählten Landes in die Dropdown-Liste für den Zustand eingetragen. Ich erhalte die Daten von Land und Staat aus der Datenbank, und in der Tabelle des Staates gibt es ein Feld für countryId. Danke für die Hilfe.

Hier ist der Beispielcode in HTML.

            <div class="fieldBlock">
                <div><label>Country</label>&nbsp;*</div>
                <div>@Html.DropDownListFor(model => model.Country.Id, Model.CountrySelectList, new { @class = "width305", @id = "ddlCountry" })</div>
                @Html.HiddenFor(model => model.Country.Name) @Html.HiddenFor(model => model.Country.Abbreviation)
                <div>@Html.ValidationMessageFor(model => model.Employee.StateId)</div>
            </div>

            <div class="fieldBlock">
                <div>@Html.LabelFor(model => model.Employee.StateId, "State/Province")&nbsp;*</div>
                <div>@Html.DropDownListFor(model => model.Employee.StateId, Model.CountryStateProvinceSelectList, new { @class = "width305" })</div>
                <div>@Html.ValidationMessageFor(model => model.Employee.StateId)</div>
            </div>

Antworten auf die Frage(1)

Ihre Antwort auf die Frage