I am trying to use the ListModel model as a generic list model. I would like to enter the page
@Html.DisplayForModel()
However, MVC does not find the template file "ListModel.cshtml" correctly. It should work differently for general models. What should I name a template file so that it can be positioned correctly?
public class ListModel<T>
{
public IEnumerable<T> Models { get; set; }
public string NextPage { get; set; }
}
I expect him to look Shared/DisplayTemplates/ListModel.ascx, but it is not. Somebody knows?
Edit:
In the end, I decided to solve this by simply deleting such a common parameter. I really want to know if you still have a common file name.
public class ListModel
{
public IEnumerable Models {get;set;}
public string NextPage {get;set;}
}
source
share