public void OnLoadView() { //为查询条件中Cbo绑定 BindComBox.BindAreaType(cboAreaType); //为Grid中Cbo绑定 List <AreaTypeDto> areaTypeList = new List <AreaTypeDto>(); DataSet ds = webService.GetAllAreaType(); if (ds.Tables[0].Rows.Count > 0) { for (int i = 0; i < ds.Tables[0].Rows.Count; i++) { AreaTypeDto areaType = new AreaTypeDto(); areaType.AreaTypeCode = Convert.ToString(ds.Tables[0].Rows[i]["AreaTypeCode"]); areaType.AreaTypeName = Convert.ToString(ds.Tables[0].Rows[i]["AreaTypeName"]); areaTypeList.Add(areaType); } } CommonHandler.BindComboBoxItems <AreaTypeDto>(cboAreaTypeInGrid, areaTypeList, "AreaTypeName", "AreaTypeCode"); dataHandler = new XtraGridDataHandler <AreaDto>(grvArea); }