Note that there are some explanatory texts on larger screens.

plurals
  1. POMVC3 DropDownlistFor SelectedValue
    text
    copied!<p>I have a really strange issue on one of my edit pages. The dropdown below never get's the selected value.</p> <pre><code> @Html.DropDownListFor(model =&gt; model.Bodymaterial, (IEnumerable&lt;SelectListItem&gt;)ViewBag.Bodymaterial) </code></pre> <p>However the following dropdown on the same page does get the selectedvalue.</p> <pre><code> @Html.DropDownListFor(model =&gt; model.Unit, (IEnumerable&lt;SelectListItem&gt;)ViewBag.Units) </code></pre> <p>The first one is rendered like this. </p> <p><code>&lt;select id="Bodymaterial" name="Bodymaterial"&gt; &lt;option value="EDTA"&gt;EDTA&lt;/option&gt; &lt;option value="SWAB"&gt;SWAB&lt;/option&gt; &lt;option value="UR"&gt;UR&lt;/option&gt; &lt;option value="FAE"&gt;FAE&lt;/option&gt; &lt;option value="IOF"&gt;IOF&lt;/option&gt; &lt;option value="SKIN"&gt;SKIN&lt;/option&gt; &lt;option value="HEP"&gt;HEP&lt;/option&gt; &lt;option value="CLOT"&gt;CLOT&lt;/option&gt; &lt;option value="CIT"&gt;CIT&lt;/option&gt; &lt;option value="CRM"&gt;CRM&lt;/option&gt; &lt;option value="CSF"&gt;CSF&lt;/option&gt; &lt;option value="RNA"&gt;RNA&lt;/option&gt; &lt;option value="MILK"&gt;MILK&lt;/option&gt; &lt;option value="BUC"&gt;BUC&lt;/option&gt; &lt;/select&gt;</code></p> <p>The second on is rendered as it should be.</p> <p><code>&lt;select data-val="true" data-val-required="The Unit field is required." id="Unit" name="Unit"&gt;&lt;option selected="selected" value="µl"&gt;&amp;#181;l&lt;/option&gt; &lt;option value="ml"&gt;ml&lt;/option&gt; &lt;option value="l"&gt;l&lt;/option&gt; &lt;option value="µg/ml"&gt;&amp;#181;g/ml&lt;/option&gt; &lt;/select&gt;</code></p> <p>Why the second one is rendered correct and the first one not? Please help....</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload