Note: this is a mock-up, thus the hard coded states for testing purposes.
I'm simply trying to pass up a generic list from my model to my controller and then use that list to bind to a Select.
Model has:
public class StatesModel
{
public static List<string> RetrieveAllStates()
{
List<string> states = new List<string> { "AL",
"AK",
"AZ"};
return states;
}
}
Controller has:
[ControllerAction]
public void OrderExample()
{
List<string> states = new List<string>();
states = StatesModel.RetrieveAllStates();
RenderView("OrderExample", states);
}
View has:
<%
=Html.Select("State", ViewData["states"]) %>
Error: DataBinding: 'System.Collections.Generic.List`1[[System.String, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]]' does not contain a property with the name 'states'.