Posted 17 February 2019, 10:22 pm EST
- Updated 3 October 2022, 4:19 pm EST
Hi Jitender,
Thank you for your quick reply. Here’s the revised sample. It happens when a master-detail is present. I added 2nd grid and revised the Form1_Load() as follows to present the data in a master-detail view:
private void Form1_Load(object sender, EventArgs e)
{
//c1TrueDBGrid1.DataSource = GetDataTable();
DataSet ds = new DataSet();
DataTable dt1 = GetDataTable();
dt1.TableName = “Header”;
DataTable dt2 = GetDataTable();
dt2.TableName = “Detail”;
ds.Tables.Add(dt1);
ds.Tables.Add(dt2);
//
DataColumn parentDC= ds.Tables[0].Columns[“SeqNo”];
DataColumn childDC = ds.Tables[1].Columns[“SeqNo”];
c1TrueDBGrid1.DataSource = dt1.DefaultView ;
c1TrueDBGrid1.AllowAddNew = true;
//
c1TrueDBGrid2.DataSource = dt2.DefaultView;
c1TrueDBGrid2.AllowAddNew = true;
//
ds.Relations.Add("Detail", parentDC, childDC);
//
c1TrueDBGrid1.SetDataBinding(ds, "Header", true);
c1TrueDBGrid2.SetDataBinding(ds, "Header.Detail", true);
//Now even if there's no unbound column, the issue still exists.
//ecAddUnboundColumn(c1TrueDBGrid2, "RowNo", 0);
//ecAddUnboundColumn(c1TrueDBGrid1, "RowNo", 0);
}
Thanks
Ricky