title: MVC dropdownlist, onchange
body: <p>I have a 2 Dropdownlistfor in html, dropdownlistfor Country and dropdownlistfor state. Im using MVC, I want to be the output like this, If I change the Selected Country, the state of the selected country will be filled in the dropdownlistfor state. Im getting the data of country and state from database, and in the table of state there is a field for countryId. Thanks for help. </p>
  
  <p>here is the sample Code in Html. </p>
  
  <pre><code>            &lt;div class="fieldBlock"&gt;
                  &lt;div&gt;&lt;label&gt;Country&lt;/label&gt;&amp;nbsp;*&lt;/div&gt;
                  &lt;div&gt;@Html.DropDownListFor(model =&gt; model.Country.Id, Model.CountrySelectList, new { @class = "width305", @id = "ddlCountry" })&lt;/div&gt;
                  @Html.HiddenFor(model =&gt; model.Country.Name) @Html.HiddenFor(model =&gt; model.Country.Abbreviation)
                  &lt;div&gt;@Html.ValidationMessageFor(model =&gt; model.Employee.StateId)&lt;/div&gt;
              &lt;/div&gt;
  
              &lt;div class="fieldBlock"&gt;
                  &lt;div&gt;@Html.LabelFor(model =&gt; model.Employee.StateId, "State/Province")&amp;nbsp;*&lt;/div&gt;
                  &lt;div&gt;@Html.DropDownListFor(model =&gt; model.Employee.StateId, Model.CountryStateProvinceSelectList, new { @class = "width305" })&lt;/div&gt;
                  &lt;div&gt;@Html.ValidationMessageFor(model =&gt; model.Employee.StateId)&lt;/div&gt;
              &lt;/div&gt;
  </code></pre>