<ig:WebHierarchicalDataGrid ID="whdg" runat="server" Height="350px" Width="400px" DataKeyFields="ID"></ig:WebHierarchicalDataGrid>
DataTable dtContract = new DataTable("Contract"); dtContract.Columns.Add("ID"); dtContract.Columns.Add("CName");
DataRow drContract; drContract = dtContract.NewRow(); drContract[0] = "11"; drContract[1] = "Origin"; dtContract.Rows.Add(drContract);
DataTable dtPipe = new DataTable("Pipe"); dtPipe.Columns.Add("ID"); dtPipe.Columns.Add("PName");
DataRow drSwp; drSwp = dtPipe.NewRow(); drSwp[0] = "11"; drSwp[1] = "SWP"; dtPipe.Rows.Add(drSwp);
DataSet ds = new DataSet(); ds.Tables.Add(dtContract); ds.Tables.Add(dtPipe);
ds.Relations.Add("ID", ds.Tables["Contract"].Columns["ID"], ds.Tables["Pipe"].Columns["ID"]);
whdg.DataSource = ds; whdg.DataBind();
ERROR:
Hi rajeshshirke,
Thank you for posting in the community.
I suggest that you try setting a primary key for both of your datatables in this scenraio, i.e:
Please let me know if this helps.
Hi,
i set primarykey for both tables
dtContract.PrimaryKey =
new DataColumn[] { dtContract.Columns["ID"] };
dtPipe.PrimaryKey =
new DataColumn[] { dtPipe.Columns["ID"] };
But still shows the same error
Help ME