Using ASP.NET MVC v2 EditorFor and DisplayFor with IEnumerable<T> Generic types -


I have IList < Tag & gt; When I call DisplayFor or EditorFor in my model tag as a property named How do I name files for display and editor templates? Uses:

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

Popular posts from this blog

asp.net - Javascript/DOM Why is does my form not support submit()? -

sockets - Delphi: TTcpServer, connection reset when reading -

javascript - Classic ASP "ExecuteGlobal" statement acting differently on two servers -