在MVC项目中,需要使用DropDownList绑定Model数据。

目前使用的方法:

先定义SelectListItem的list类型

<%var VisitCaselist = new List<SelectListItem>() {
(
new SelectListItem() { Text = "", Value = "" , Selected=true}),
(
new SelectListItem() { Text = "成功回访", Value = "成功回访" }),
(
new SelectListItem() { Text = "不成功回访", Value = "不成功回访" }),
(
new SelectListItem() { Text = "无需回访", Value = "无需回访" })
};
%>

再使用DropDownList进行绑定

<%= Html.DropDownList("Edit_VisitCase", VisitCaselist, Model.VisitCase)%>
oK

相关文章:

  • 2022-12-23
  • 2021-09-09
  • 2022-12-23
  • 2022-12-23
  • 2021-11-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-08-19
  • 2022-12-23
  • 2021-08-26
  • 2021-08-09
  • 2022-12-23
相关资源
相似解决方案