문제

I'm trying to just ever so slightly tweak the default EditorTemplate for a SelectList. Is there somewhere where I can find the source for all the default EditorTemplates (i.e so I have a base reference to work off of).

I've had a peek on the asp.net mvc source page and cannot find the templates listed in their source code (although I am most likely missing it).

도움이 되었습니까?

해결책

The default EditorTemplate for a SelectList is actually just this method: System.Web.Mvc.Html.SelectExtensions.SelectInternal()

So it is not implemented as a .cshtml template at all. Instead it builds up the markup in C# using a TagBuilder. You could take this implementation as a starting point for your own C# method, or else port it into the equivalent razor syntax.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top