DEV GridView嵌套
Posted 武道巅峰
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了DEV GridView嵌套相关的知识,希望对你有一定的参考价值。
/// <summary>
/// 绑定主表和明显表到GridView
/// </summary>
/// <param name="machineProduct">主表</param>
/// <param name="configureData">字表</param>
private void MasterDatailToGridView(DataTable machineProduct, DataTable configureData)
{
machineProduct.TableName = "MachineProduct";
DataSet ds = new DataSet();
ds.Tables.Add(machineProduct);
DataTable dtNew = configureData.Clone();
dtNew.TableName = "AccessoryConfigure";
foreach (DataRow dr in configureData.Rows)
{
object[] arr = dr.ItemArray;
dtNew.Rows.Add(arr);
}
ds.Tables.Add(dtNew);
//关联字段为GOODS_ID(商品ID)
DataColumn keyColumn = ds.Tables["MachineProduct"].Columns["GOODS_ID"];
DataColumn foreignKeyColumn = ds.Tables["AccessoryConfigure"].Columns["GOODS_ID"];
ds.Relations.Add("商品单位", keyColumn, foreignKeyColumn, false);
this.gridControl1.DataSource = ds.Tables["MachineProduct"];
this.gridControl1.ForceInitialize();
MachineProductGridView.ExpandAllGroups(); // 默认展开分组
}
#endregion
以上是关于DEV GridView嵌套的主要内容,如果未能解决你的问题,请参考以下文章
listview嵌套gridview,怎么设置gridview的点击事件
android listview里面能嵌套gridview吗
Android ListView中嵌套GridView,GridView不显示