There are a couple of posts about this on Stack Overflow but none with an answer that seem to fix the problem in my current situation.
I have a page with a table in it, each row has a number of text fields and a dropdown. All the dropdowns need to use the same SelectList data so I have set it up as follows:
Controller
ViewData["Submarkets"] = new SelectList(submarketRep.AllOrdered(), "id", "name");
View
<%= Html.DropDownList("submarket_0", (SelectList)ViewData["Submarkets"], "(none)") %>
I have used exactly this setup in many places, but for some reason in this particular view I get the error:
There is no ViewData item of type 'IEnumerable' that has the key 'submarket_0'.