分享

关于第三方控件DevExpress中XtraGrid用法,动态邦定数据

 北方的白桦林 2017-07-23

关于第三方控件DevExpress中XtraGrid用法,动态邦定数据  

 

DataTable data = DAL.XXDA.EDIT.spda.get("SelectAll", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "");
//创建一个新列
DevExpress.XtraGrid.Columns.GridColumn con = new DevExpress.XtraGrid.Columns.GridColumn();
con.FieldName = "item_no";//对应邦定的数据源名称
con.Name = "编号";
con.Caption = "编号";//显示给用户的名称
con.Visible = true;
con.VisibleIndex = 0;//显示列的位置
this.gridView1.Columns.Add(con);
con = new DevExpress.XtraGrid.Columns.GridColumn();
con.FieldName = "barcode";
con.Name = "条形码";
con.Caption = "条形码";
con.Visible = true;


con.VisibleIndex = 1;
this.gridView1.Columns.Add(con);
con = new DevExpress.XtraGrid.Columns.GridColumn();
con.FieldName = "item_name";
//con.Name = "商品名称";
con.Caption = "商品名称";
con.Visible = true;
con.VisibleIndex = 2;//
this.gridView1.Columns.Add(con);
//邦定
this.gridControl1.DataSource = data;
//设置行标题的宽度
gridView1.IndicatorWidth = 60;
//获取单元格的值
string str=this.gridView1.GetRowCellDisplayText(0, this.gridView1.Columns[0]);

    本站是提供个人知识管理的网络存储空间,所有内容均由用户发布,不代表本站观点。请注意甄别内容中的联系方式、诱导购买等信息,谨防诈骗。如发现有害或侵权内容,请点击一键举报。
    转藏 分享 献花(0

    0条评论

    发表

    请遵守用户 评论公约

    类似文章 更多