Problem with MVC EditorFor named template

后端 未结 3 2150
滥情空心
滥情空心 2020-12-25 13:42

I have what appears (to me anyway) to be a strange problem...

I created a simple editor template for a SelectListItem (SelectListItem.cshtml in the ~/Views/Shared/Ed

3条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-12-25 14:12

    Just an update, I stumbled on this question trying to address the same issue myself.

    What I ended up doing was iterating through each instance of the collection and calling the EdtorFor individually, sort of like this:

      @for (int i=0;i c.Categories[i], "CategoryIcons") }

    Still not clean, but I like it better than inheriting a new class like you ended up doing.

    (Sorry if my C# syntax is a little off, I write in vb.net)

提交回复
热议问题