I'm trying list items in my MVC view, following this example: Model Binding to a List. I'm using MVC 5. There example says to do this:
<%@ Page Inherits="ViewPage<IList<Book>>" %>
<% for (int i = 0; i < 3; i++) { %>
<%: Html.EditorFor(m => m[i]) %>
<% } %>
I'm trying to do this:
for (int i = 0; i < Model.SubmissionTypesSelected.Count(); i++)
{
Html.EditorFor(m => m.SubmissionTypesSelected[i]);
}
SubmissionTypesSelected
is defined like this:
public ICollection<PTSubTypeSelected> SubmissionTypesSelected { get; set; }
I get this message:
Cannot apply indexing to an expression of type 'System.Collections.Generic.ICollection'