编辑器对于 int 选择一个字符串模板



我有两个编辑器模板

string.cshtml
int.cshtml

当我写EditorFor stringint时,他们都选择string.cshtml

当我什至删除string.cshtml时,intEditorFor不会选择int.cshtml

EditorTemplates 使用 CLR 类型名,而不是 C# 关键字。
您需要创建Int32.cshtml

您的 int 模板的名称应为Int32.cshtml

string.cshtml之所以有效,是因为系统命名空间中存在一个名为 String ;) 的 CLR 类型

模板名称的调用必须与所需的类型相同。

更多信息

  • ASP.NET MVC 2 模板
  • 自定义 MVC 数字编辑器模板

相关内容

最新更新