I've got a table which has the usual ParentID, ChildID as it's first two columns in a self-referencing tree data structure.
My issue is that when I pull this out and use the following code:
DataSet set = DA.GetNewCategories();
set.Relations.Add(
new DataRelation("parentChildCategories", set.Tables[0].Columns["CategoryParentID"], set.Tables[0].Columns["CategoryID"])
);
StringBuilder buildXml = new StringBuilder();
StringWriter writer = new StringWriter(buildXml);
set.WriteXml(writer);
TreeView2.DataSource = new HierarchicalDataSet(set, "CategoryID", "CategoryParentID");
TreeView2.DataBind();
I get the error:
These columns don't currently have unique values
I believe this is because my data has children with multiple parent nodes. This is fine for my application - I don't mind if one row of data is rendered in multiple nodes of my TreeView.
Could someone shed light on this please? It doesn't seem unreasonable to have a DataSet render XML which has nodes appearing in multiple places, but I can't figure out how to do it.
Thanks,
Matt.