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?
Edit:
I did end up solving this by simply removing the generic parameter like so. I do want to know if you can still have a generic file name though.
public class ListModel
{
public IEnumerable Models {get;set;}
public string NextPage {get;set;}
}