.net mvc 遍历枚举取得列表

using System.Web.Mvc.Html;

EnumHelper.GetSelectList(typeof(OperationType));
OperationType 如下
public enum OperationType:int
    {
        /// <summary>
        /// 系统
        /// </summary>
        [Display(Name ="系统")]
        sys = 1,
        /// <summary>
        /// 用户
        /// </summary>
        [Display(Name = "用户")]
        user = 2,
        /// <summary>
        /// 代理
        /// </summary>
        [Display(Name = "代理")]
        agent = 3,
        /// <summary>
        /// 订单
        /// </summary>
        [Display(Name = "订单")]
        order = 4,
        /// <summary>
        /// 财务
        /// </summary>
        [Display(Name = "财务")]
        finance = 5,
        /// <summary>
        /// 接口
        /// </summary>
        [Display(Name = "接口")]
        gate = 6
    }

下拉列表

  <select name="logtype">
                            <option value="">所有类型</option>
                                <option value="1">系统</option>
                                <option value="2">用户</option>
                                <option value="3">代理</option>
                                <option value="4">订单</option>
                                <option value="5">财务</option>
                                <option value="6">接口</option>
                        </select>

 

posted @ 2021-05-26 09:49  拼博之路  阅读(148)  评论(0编辑  收藏  举报