更新时间:2023-02-01 10:22:50
为什么不只是使用助手吗?在MVC 5中,此处理程序已经可用,最简单的方法是为Enum类型创建编辑器模板。你可以在这里找到帮助者的代码:
http://blogs.msdn.com/b/stuartleeks/archive/2010/05/21/asp-net- mvc-creating-a-dropdownlist-helper-for-enums.aspx [ ^ ]
祝你好运!
Why not just use a helper for that? In MVC 5 this handler is already available and the easiest way is to create an editor template for Enum types. You can find the code for the helper here:
http://blogs.msdn.com/b/stuartleeks/archive/2010/05/21/asp-net-mvc-creating-a-dropdownlist-helper-for-enums.aspx[^]
Good luck!