Using ASP.NET MVC v2 EditorFor and DisplayFor with IEnumerable<T> Generic types -
I have IList < Tag & gt; When I call
How do I name files for display and editor templates? Uses: DisplayFor
or EditorFor
in my model tag
as a property named
Model
Category MyModel {IList < Tag & gt; Tags {get; Protected Set; }}
See
<% = Html.EditorFor (t => t.Tags)%>
edit I know I can do this, but not what I want to do.
& lt;% = HTML .EditorFor (t = & gt; tags, tags, "tag list")% & gt; Use the attribute [[UIHint ("tag")], then create a display template that has been named.
class MyModel {[UIHint ("tag")] IList & lt; Tag & gt; Tags {get; Protected Set; }}
and the tags in the file .ascx
& lt;% @ Control Language = "C #" Inherits = "System.Web.Mvc. ViewUserControl & lt; IEnumerable & lt; tags & gt; & gt; "& gt;; & Lt ;! - Put your model code here - & gt;
Works for me
Comments
Post a Comment