添加控件
初始化控件并绑定数据
private void ViewQcmCoaTemplateList()
{
DataTable dt = QCMLIST.ViewQcmCoaTemplateList();
DataRow dr = dt.NewRow();
dr[0] = "";
dt.Rows.InsertAt(dr, 0);
DevGridLookupHelper.InitPopup(this.gluCOATemplate, new string[] { "选择模块ID" }, dt);
}
注:
1、使用GridLookUpEdit控件(显示值时)之前必须先将其初始化,然后才能使用(给控件赋值):
gluCOATemplate.Text =saTableKeys[2];//gluCOATemplate.EditValue
2、初始化绑定数据后,给控件赋值显示时,只有当该值跟被绑定的数据中的一项相等时,才能显示。
另:1、时间控件用DateEdit,DateEdit1.Text获取值
绑定显示两列:
DataTable dt = this.ViewExistLotMatReq();
DevGridLookupHelper.InitPopup(this.gluMatID, new string[] { "选择物料ID","选择物料版本号" }, dt);
获取第二列值需重新调用服务,再从返回结果中获取
2、只显示某一列(非第一列),需用repositoryItemGridLookUpEdit1绑定(而不是gluMatID),将前面的string设为空字符串,再加上要显示的列名索引和列值索引即可:
DataTable dt = this.ViewExistLotMatReq();
DevGridLookupHelper.InitPopup(this.repositoryItemGridLookUpEdit1, new string[] { "", "选择FAB" }, dt, 1, 1);
===============
private void gldResIdAddData()
{
DataTable dt = ListRoutineFDC.ViewFDCResourceList();
if (dt != null)
{
DataRow dr = dt.NewRow();
dr[0] = "";
dt.Rows.InsertAt(dr, 0);
DevGridLookupHelper.InitPopup(this.gldResid, new string[] { "选择设备ID" }, dt);
}
else
{
DataTable dt1 = new DataTable();
dt1.Columns.Add(" ");
dt1.Rows.Add("");
DevGridLookupHelper.InitPopup(this.gldResid, new string[] { "选择设备ID" }, dt1);
}
}