title: Add a condition in Html.DropDownList within asp.net mvc4 application
body: <p>I have used this snippet in my view </p>
  
  <pre><code>&lt;SELECT  name="id_category"&gt;
               @for (int item = 0; item &lt; list_cat.Count; item++){
                      if (@list_cat[item].Id_category == @Model.Id_category) {
                      &lt;OPTION VALUE="@list_cat[item].Id_category" selected &gt;@list_cat[item].CName&lt;/OPTION&gt;}
                      else{
                      &lt;OPTION VALUE="@list_cat[item].Id_category" &gt;@list_cat[item].CName&lt;/OPTION&gt;
                          }
                                                 }
                    &lt;/SELECT&gt;
  </code></pre>
  
  <p>then, i replaced it by </p>
  
  <pre><code> @Html.DropDownList("id_category", new SelectList(list_cat,"Id_category","CName"))
  </code></pre>
  
  <p>But the condition of selection of the item is missing.</p>
  
  <p>How can i replace it with <code>Html.DropDownList</code>? Any suggestions?</p>