DevExpress下拉列表(GridLookUpEdit)绑定数据

本文介绍了如何在DevExpress的GridLookUpEdit控件中绑定数据并进行初始化操作。控件在赋值显示时,需要确保值与绑定数据匹配。同时,提到了DateEdit控件的使用方法以及如何绑定显示特定列,包括如何获取第二列的值和仅显示非首列的某一列。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

添加控件

55acf7b46cdc939fdf31fdcda84b856632e.jpg 初始化控件并绑定数据

 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);
            }
        }

 

转载于:https://my.oschina.net/8824/blog/3085586

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值