title: Get selectedIndex of dropdown using c# (Razor)
body: <p>Is it possible to get the selectedIndex of a dropdown in a view using C# (Razor). For example, can I fill a second dropdown based off the selectedIndex of another dropdown using Razor?</p>
  
  <pre><code>@model ViewModel
  
  &lt;select id="dropdown1"&gt;
  //Options
  &lt;/select&gt;
  
  &lt;select id="dropdown2"&gt;
  //Options
  &lt;/select&gt;
  
  @if(//The selectedIndex of dropdown1 == 4)
  {
  //Fill dropdown 2 from model
  }
  </code></pre>
  
  <p>When using Javascript, I am a little off as well:</p>
  
  <pre><code>            &lt;script&gt;
              if (dropdown1.selectedIndex === 3)
              {
                  @foreach (var item in Model)
                  {
  
                  }
              }
          &lt;/script&gt;
  </code></pre>