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',但似乎沒有工作:( –