Controller: 1//获取下拉信息表 //_vendorsAppService.GetAllObj() 是获取下拉列表结果集 2 ViewData["vendlist"] = new SelectList(_vendorsAppService.GetAllObj(), "Id", "Name", dto.VendorsId); View: <div class="form_group fl"> <label class="gry fl">供应商:</label> @Html.DropDownList("sVendorsId", ViewData["vendlist"] as IEnumerable<SelectListItem>, new { @class = "btn dropdown-toggle form-control" }) </div>
或者
Controller:
WithdrawalsApplyDto dto = new WithdrawalsApplyDto();
IEnumerable<SelectListItem> selList2 = TxEnumHelper.EnumToListItem(typeof(WithdrawalsApplyDto.StateWithdrawalsApply), dto.State);
ViewData["State"] = selList2;
View: <div class="form_group fl"> <label class="gry fl">供应商:</label> @Html.DropDownList("DDLState", ViewData["State"] as IEnumerable<SelectListItem>, new { @class = "btn dropdown-toggle form-control" }) </div>