protected override List <object> GetDataSource() { DeptBll deptBll = new DeptBll(AppSettings.CurrentSetting.ParkConnect); depts = deptBll.GetAllDepts().QueryObjects.ToList(); List <object> source = new List <object>(); foreach (object o in depts) { source.Add(o); } return(source); }
public void Init() { DeptBll bll = new DeptBll(Ralid.Park.BusinessModel.Configuration.AppSettings.CurrentSetting.ParkConnect); //this.DataSource = bll.GetAllDepts().QueryObjects; List <DeptInfo> items = bll.GetAllDepts().QueryObjects; this.Items.Clear(); this.Items.Add(""); foreach (var item in items) { this.Items.Add(item); } this.DisplayMember = "DeptName"; this.ValueMember = "DeptID"; this.DropDownStyle = ComboBoxStyle.DropDownList; }