var statusSelectItems = new List<SelectListItem> { new SelectListItem{Text="失联",Value="0"}, new SelectListItem{Text="正常",Value="1"}, new SelectListItem{Text="维修",Value="2"}, new SelectListItem{Text="维护",Value="3"}, new SelectListItem{Text="下线",Value="4"}, new SelectListItem{Text="其他",Value="5"}, }; ViewData["statusSelect"] = new SelectList(statusSelectItems, "Value", "Text");
<div class="col-md-6"> <div class="form-group"> <label class="control-label col-md-3"> @Html.DisplayNameFor(tDto => tDto.Model) </label> <div class="col-md-8"> @Html.DropDownListFor(tDto => tDto.Model, ViewData["payPatternSelect"] as SelectList, "---请选择模式---", new { @class = "form-control" }) </div> </div> </div>