/// <summary> /// 初始化数据 /// </summary> private void IniData() { //处理查询方式数据源 BEGIN DataTable dtQueryType = new DataTable(); dtQueryType.Columns.Add(new DataColumn("Name", typeof(string))); for (int i = 0; i < saveQueryTypeArray.Length; i++) { DataRow dr = dtQueryType.NewRow(); dr["Name"] = saveQueryTypeArray[i]; dtQueryType.Rows.Add(dr); } FCommon.LoadDropRepositoryComb(drpQType, dtQueryType, "Name", true); //处理查询方式数据源 END //绑定查询字段数据源 BEGIN drpColFieldName.ShowHeader = false; drpColFieldName.ShowFooter = false; FCommon.RepositoryLookupEditColAdd(drpColFieldName, new int[] { 0, 100 }, new string[] { "FieldName", "Caption" }, new string[] { "", "" }, new bool[] { false, true }); DataTable dtParentQueryFiled = GetParentQueryFiled(); FCommon.LoadDropRepositoryLookUP(drpColFieldName, dtParentQueryFiled, "Caption", "FieldName", false);//查询数据 //绑定查询字段数据源 END BindGrid(GetGridSource());//处理Grid if (_HTDataQueryFieldDefault.Count != 0) { for (int i = 0; i < _HTDataQueryFieldDefault.Count; i++) { if (gridView1.RowCount <= i || dtParentQueryFiled.Rows.Count <= i)//溢出,异常退出循环 { break; } string[] tempA = (string[])_HTDataQueryFieldDefault[i];//默认数组 gridView1.SetRowCellValue(i, "ConType", tempA[0]); gridView1.SetRowCellValue(i, "ColFieldName", tempA[1]); gridView1.SetRowCellValue(i, "QType", tempA[2]); } } else { //初始化前5行数据 for (int i = 0; i < 5; i++) //初始化5行 { if (gridView1.RowCount <= i || dtParentQueryFiled.Rows.Count <= i) //溢出,异常退出循环 { break; } gridView1.SetRowCellValue(i, "ColFieldName", dtParentQueryFiled.Rows[i]["FieldName"].ToString()); gridView1.SetRowCellValue(i, "QType", "="); } } }