//绑定栏目二的项目名 private void BindProject(bool isFlush) { if (UserHelper.ContractProjectList == null || isFlush == true) { int categoryId = Convert.ToInt32(this.IdCategory.SelectedValue); List <ContractProject> list = new List <ContractProject>(); list = _sc.QueryContractProject(categoryId); UserHelper.ContractProjectList = list; } this.xmName.DataSource = UserHelper.ContractProjectList; this.xmName.ValueMember = "Id"; this.xmName.DisplayMember = "Project"; this.xmName.SelectedIndex = 0; // FOR DEBUG //MessageBox.Show("Idcategory" + this.IdCategory.SelectedValue + ", Pname" + this.pName.SelectedValue + ", Xmname " + this.xmName.SelectedValue); }
private void BindProject(bool isFlush) { if (UserHelper.ContractProjectList == null || isFlush == true) { //int categoryId = Convert.ToInt32(this.SelectedCategory.SelectedValue); int categoryId = int.Parse(((ComboboxItem)this.SelectedCategory.SelectedItem).Value); List <ContractProject> list = new List <ContractProject>(); list = _sc.QueryContractProject(categoryId); UserHelper.ContractProjectList = list; } /// dataGridView3是Project的List this.dataGridView3.DataSource = UserHelper.ContractProjectList; /// 绑定 this.SelectedProject.ValueMember = "Id"; this.SelectedProject.DisplayMember = "Project"; this.SelectedProject.DataSource = UserHelper.ContractProjectList; }