日期:2014-05-16  浏览次数:20890 次

DevExpress.XtraGrid.GridControl控件的使用

如上图的五个表,前四个表输入字符失去焦点后字符也丢失,第五个可以输入成功,觉得跟以下代码有关,但不知何原因,求解??
string sqlString = string.Format("SELECT * FROM T_HRMS_员工学历表 where 人员编码 = '{0}'", dr["人员编码"].ToString());
this.gridControl1.DataSource = DataBase.GetDataTable(sqlString);
this.gridView1.BestFitColumns();
sqlString = string.Format("SELECT * FROM T_HRMS_员工职称表 where 人员编码 = '{0}'", dr["人员编码"].ToString());
this.gridControl2.DataSource = DataBase.GetDataTable(sqlString);
this.gridView2.BestFitColumns();
sqlString = string.Format("SELECT * FROM T_HRMS_员工职务表 where 人员编码 = '{0}'", dr["人员编码"].ToString());
this.gridControl3.DataSource = DataBase.GetDataTable(sqlString);
this.gridView3.BestFitColumns();
sqlString = string.Format("SELECT * FROM T_HRMS_员工家庭表 where 人员编码 = '{0}'", dr["人员编码"].ToString());
this.gridControl4.DataSource = DataBase.GetDataTable(sqlString);
this.gridView4.BestFitColumns();
sqlString = string.Format("SELECT * FROM T_HRMS_员工奖励表 where 人员编码 = '{0}'", dr["人员编码"].ToString());
this.gridControl5.DataSource = DataBase.GetDataTable(sqlString);
this.gridView5.BestFitColumns();

------解决方案--------------------
你的这段代码写在什么事件中的?是不是每次提交都重新绑定了一次?
------解决方案--------------------
看现象是Grid没有绑定数据源。
------解决方案--------------------
难不成是最后一段覆盖了前面的?