/// <summary> /// 下拉显示 /// </summary> private void BindCbx() { List <AppraisalBases> appraisalBases = new List <AppraisalBases>(); //appraisalBases.Add(new AppraisalBases //{ // Id = 0, // BaseType = "查询所有", // AppraisalBase = 0, // IsDel = false //}); //IEnumerable<AppraisalBases> appraisalBases1 = AppraisalBases.ListAll(); //appraisalBases.AddRange(appraisalBases1); // 单向绑定 appraisalBases = AppraisalBases.ListAll(); appraisalBases.Insert(0, new AppraisalBases { Id = 0, BaseType = "查询所有", AppraisalBase = 0, IsDel = false }); comBase.DataSource = appraisalBases; comBase.DisplayMember = "BaseType"; comBase.ValueMember = "Id"; //comBase.Text = "查询所有"; //comBase.Items.Add("查询所有"); //foreach (var appraisalBase in appraisalBases) //{ // comBase.Items.Add(appraisalBase.BaseType); //} }
private void FrmSetUser_Load(object sender, EventArgs e) { List <AppraisalBases> appraisalBases = new List <AppraisalBases>(); appraisalBases = AppraisalBases.ListAll(); comBase.DataSource = appraisalBases; comBase.DisplayMember = "BaseType"; comBase.ValueMember = "Id"; tName.Text = _user.UserName; comBase.SelectedValue = _user.BaseTypeId; comsex.Text = _user.Sex; chkIsStop.Checked = _user.IsDel; }
private void FrmBaseManager_Load(object sender, EventArgs e) { dgvBase.DataSource = AppraisalBases.ListAll(); }