MVC Display Template for Generic Type
- by Kyle
I am trying to use the model ListModel as a generic list model. I would like to enter on the page
@Html.DisplayForModel()
However the MVC is not correctly finding the templated file "ListModel.cshtml". It must work differently for generic models. What should I name the templated file in order for it to correctly be located?
public class ListModel<T>
{
public IEnumerable<T> Models {get;set;}
public string NextPage {get;set;}
}
I would expect it to look for "Shared/DisplayTemplates/ListModel.ascx" but it doesn't. Does anyone know?