Note that there are some explanatory texts on larger screens.

plurals
  1. POMVC - There is no ViewData item of type 'IEnumerable' that has the key '*******'
    primarykey
    data
    text
    <p>This is annoying me. It works perfectly on the load and if I complete the form and submit it. If however I don't update any values hence should generate validation errors due to null values, it shows the following error.</p> <ul> <li>$exception {"There is no ViewData item of type 'IEnumerable' that has the key 'TenantType'."} System.Exception {System.InvalidOperationException}</li> </ul> <p>The error is correct, there is no viewdata with the same name as the dropdown. The dropdowns are generic so I have shared them, ie. some have Yes/No. Why is it asking for viewdata of the same name as the control when clearly I point at something else?</p> <p>View Extract</p> <pre><code> &lt;div class="editor-field"&gt; @Html.DropDownList("TenantType", ViewData["list7"] as SelectList) &lt;/div&gt; @Html.ValidationMessageFor(model =&gt; model.TenantType) </code></pre> <p>Controller Extract</p> <pre><code> var list7 = new SelectList(new[] { new {ID="",Name="Please Select"}, new {ID="Professional",Name="Professional"}, new {ID="Student",Name="Student"}, new {ID="DSS Family",Name="DSS Family"}, new {ID="DSS Individuals",Name="DSS Individuals"}, new {ID="Local Authority",Name="Local Authority"}, new {ID="Holiday Home",Name="Holiday Home"}, new {ID="Asylum Seekers",Name="Asylum Seekers"}, }, "ID", "Name", 1); ViewData["list7"] = list7; </code></pre> <ul> <li>$exception {"There is no ViewData item of type 'IEnumerable' that has the key 'TenantType'."} System.Exception {System.InvalidOperationException}</li> </ul>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

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