title: Html select dropdown list - how to choose the selected value from server code
body: <p>I have a select list say of states in the country, which i have in a helper to include easily in any form. (removing most options to make it brief).</p>
  
  <p>I have the value of the current selection stored in the database say "CA". How would i set selected="true" to option CA before rendering the list to the user?</p>
  
  <pre><code>@helper StateSelect(string name = "State")
      {
      &lt;select name="@name" id="@name" class="required"&gt;
          &lt;option value=""&gt;-- Select -- &lt;/option&gt;
          &lt;option value="AK"&gt;Alaska&lt;/option&gt;
          &lt;option value="AL"&gt;Alabama&lt;/option&gt;
          &lt;option value="AR"&gt;Arkansas&lt;/option&gt;
          &lt;option value="AZ"&gt;Arizona&lt;/option&gt;
          &lt;option value="CA"&gt;California&lt;/option&gt;
          &lt;option value="CO"&gt;Colorado&lt;/option&gt;
          &lt;option value="CT"&gt;Connecticut&lt;/option&gt;
          &lt;option value="VA"&gt;Virginia&lt;/option&gt;
          &lt;option value="VT"&gt;Vermont&lt;/option&gt;
          &lt;option value="WA"&gt;Washington&lt;/option&gt;
          &lt;option value="WV"&gt;West Virginia&lt;/option&gt;
          &lt;option value="WI"&gt;Wisconsin&lt;/option&gt;
          &lt;option value="WY"&gt;Wyoming&lt;/option&gt;
      &lt;/select&gt;
  }
  </code></pre>