我有两个编辑器模板
string.cshtml
int.cshtml
当我写EditorFor
string
或int
时,他们都选择string.cshtml
当我什至删除string.cshtml
时,int
的EditorFor
不会选择int.cshtml
EditorTemplates 使用 CLR 类型名,而不是 C# 关键字。
您需要创建Int32.cshtml
。
您的 int 模板的名称应为Int32.cshtml
string.cshtml
之所以有效,是因为系统命名空间中存在一个名为 String
;) 的 CLR 类型
模板名称的调用必须与所需的类型相同。
更多信息
- ASP.NET MVC 2 模板
- 自定义 MVC 数字编辑器模板