4
我试图在Create
视图中显示类对象,其中属性为ICollection<string>
。试图在ASP.NET MVC3视图中使用EditorFor与ICollection <string>?
例如...
namespace StackOverflow.Entities
{
public class Question
{
public int Id { get; set; }
....
public ICollection<string> Tags { get; set; }
}
}
,如果观点是像StackOverflow的“问一个问题”页面,其中Tags
html元素是一个input box
..我不知道我怎么会在ASP.NET MVC3视图中这样做?
任何想法?
我试过使用EditorFor
,但没有在浏览器中显示,因为它不知道如何渲染字符串集合。
不应该是'〜/ Views/Shared/EditorTemplates/tags.cshtml'吗? –
@MystereMan,是的,它应该。感谢您的注意。 –
如何在收回数据时保留收集数据?我试着用'HiddenFor'在编辑器模板中添加一个'foreach',但似乎没有工作:( –