DevExpress控件使用之SearchLookUpEdit 列显示

RepositoryItemSearchLookUpEdit RepItem1 = new RepositoryItemSearchLookUpEdit();
            RepItem1.DataSource = ds.Tables["t_Stock"];
            RepItem1.ValueMember = "";
            RepItem1.DisplayMember = "";
            RepItem1.NullText = "";
            RepItem1.Popup += new EventHandler(RepItem1_Popup);
            gridView1.Columns[""].ColumnEdit = RepItem1;


 void RepItem1_Popup(object sender, EventArgs e)
        {
            SearchLookUpEdit SLUE = sender as SearchLookUpEdit;
            SLUE.Properties.View.Columns[0].Visible = false;
        }
View Code

 

 
 
下面只是个人备份代码
private void gridView1_CellValueChanged(object sender, DevExpress.XtraGrid.Views.Base.CellValueChangedEventArgs e)
        {
            if (e.Column.FieldName == "工序代码")
            {
                SearchLookUpEdit editor = gridView1.ActiveEditor as SearchLookUpEdit;
 
                DynWebService BHWS = new DynWebService();
                DataTable dtOper = BHWS.GetOperInfoByOper(MyHelper.strVerify, MyHelper.strIP, "B-Routing", MyHelper.strUser, Convert.ToString(editor.EditValue));

                if (dtOper.Rows.Count >= 0)
                {
                    gridView1.SetFocusedRowCellValue("工序名称", Convert.ToString(dtOper.Rows[0]["名称"]));
                    for (int i = 0; i < dtOper.Columns.Count; i++)
                    {
                        if (gridView1.Columns.Contains(gridView1.Columns[Convert.ToString(dtOper.Columns[i].ColumnName)])) gridView1.SetFocusedRowCellValue(Convert.ToString(dtOper.Columns[i].ColumnName), Convert.ToString(dtOper.Rows[0][i]));
                    }

                    
                    //if (row.Table.Columns.Contains("工价")) gridView1.SetFocusedRowCellValue("工价", Convert.ToString(row["工价"]));
                }
                else
                {
                    gridView1.SetFocusedRowCellValue("工序名称", "");
                    for (int i = 0; i < dtOper.Columns.Count; i++)
                    {
                        if (gridView1.Columns.Contains(gridView1.Columns[Convert.ToString(dtOper.Columns[i].ColumnName)])) gridView1.SetFocusedRowCellValue(Convert.ToString(dtOper.Columns[i].ColumnName), DBNull.Value);
                    }
                    //gridView1.SetFocusedRowCellValue("工价", DBNull.Value);
                }
            }
        }
View Code

 

转载于:https://www.cnblogs.com/Login-index/p/8464206.html

发布了0 篇原创文章 · 获赞 0 · 访问量 125
展开阅读全文
评论将由博主筛选后显示,对所有人可见 | 还能输入1000个字符

没有更多推荐了,返回首页

©️2019 CSDN 皮肤主题: 编程工作室 设计师: CSDN官方博客

分享到微信朋友圈

×

扫一扫,手机浏览