1、Model层定义属性

    public class vmUser
    {
        public string userName { get; set; }
        public string sex { get; set; }
        public int? age { get; set; }
        public DateTime? enrollDate { get; set; }
        public string deptName { get; set; }
        public Dictionary<string,bool> skills { get; set; }  //键值对
        public string email { get; set; }
        public string imgUrl { get; set; }
    }

2、View层控件展示

<p>擅长技能:@Html.CheckBoxFor(m => m.skills["体育"]) 体育 @Html.CheckBoxFor(m => m.skills["音乐"]) 音乐</p>

3、Action中获取结果

Dictionary<string,bool> skills = user.skills;

  

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-04-21
  • 2021-10-17
  • 2021-07-11
  • 2021-04-03
  • 2022-01-06
  • 2021-12-25
猜你喜欢
  • 2022-01-06
  • 2021-10-04
  • 2021-07-08
  • 2021-11-11
  • 2021-11-14
相关资源
相似解决方案