一、如果后臺得到的是一個List類型
1、后臺得到數組數據
var dutyList = IOCFactory.R<IEmployeeContract>().BatchFind(m => m.IsDeleted == false && m.IsEnabled == true).Select(m => new { m.EmpID, m.EmpName }).ToList();ViewBag.dutyList = dutyList;
2、前端循環綁定下拉框
<select class="form-control editable select2_category" name="selEmpID" id="selEmpID">@foreach (Object item in ViewBag.dutyList){<option value="@item.GetType().Get 二、如果后臺得到的是一個List<Employee>類型 1、后臺得到對象數組類型 List<Employee> dutyList= IOCFactory.R<IEmployeeContract>().GetListValueByTypeCode(“aa”);ViewBag.dutyList =dutyList; 2、前端循環綁定下拉框 <select class="form-control editable select2_category" name="RecruitFrom" id="RecruitFrom">@foreach (var item in ViewBag.admissions_source){ <option value="@item.id">@item.name</option>}</select>
新聞熱點
疑難解答