//绑定编号中的工程简称 和 栏目一的工程名 private void BindCategory(bool isFlush) { //窗体加载时位datagridview绑定数据源 if (UserHelper.ContractCategoryList == null || isFlush == true) { int departmentId = UserHelper.DepList[this.IdDepartShortCall.SelectedIndex].Id; List <ContractCategory> categorys = _sc.QuerySDepartmentContractCategory(departmentId); UserHelper.ContractCategoryList = categorys; } this.IdCategory.ValueMember = "Id"; this.IdCategory.DisplayMember = "CategoryShortCall"; this.IdCategory.DataSource = UserHelper.ContractCategoryList; if (_type == 10) { this.IdCategory.SelectedIndex = 2; //栏目一的工程名 this.pName.ValueMember = "Id"; this.pName.DisplayMember = "Category"; this.pName.DataSource = UserHelper.ContractCategoryList; this.pName.SelectedIndex = 2; } if (_type == 11) { this.IdCategory.SelectedIndex = 3; //栏目一的工程名 this.pName.ValueMember = "Id"; this.pName.DisplayMember = "Category"; this.pName.DataSource = UserHelper.ContractCategoryList; this.pName.SelectedIndex = 3; } }