So far, we could use Html.EditorFor () to dynamically display the corresponding template for a data type โ for example, string, int, or a custom type, for example โAddressโ.
Now I want to use EditorFor () to display the Parent field. I want a dropdown list containing each row, and the user selects a parent from this dropdown list.
The Parent template has access to the ParentID, but what about the names and line identifiers to populate the list with?
Where did they come from?
I can put the data access logic in the template, but this will break the separation of problems.
I could create an HtmlHelper that displays a list, but wouldn't that break the separation of problems, since HtmlHelpers should only do user interface stuff, not data access?
Any ideas?
source share