How to use MVC Html Helper .DropDownListFor<> with an Enum

前端 未结 6 1712
伪装坚强ぢ
伪装坚强ぢ 2020-12-30 16:01

In my MVC 3 Razor app, I have a Model with an enum..

Model Example:

public class EmployeeModel
{
 public enum Title
 {
  Accountant = 111,
  Sales =          


        
6条回答
  •  清歌不尽
    2020-12-30 16:32

    An encapsulated HTML Helper Extension is available here :

    http://www.spicelogic.com/Journal/ASP-NET-MVC-DropDownListFor-Html-Helper-Enum-5

    the source code snapshot:

    enter image description here

    You can download the full source code of the project from the link.

提交回复
热议问题