Once again, i find your documentation and demos so convoluted that I have given up trying to make any sense out it.
I am again trying to accomplish a very simple thing: make a hierarchical grid out of a simple, 2-table relational dataset.
All I wish to do is to create a simple parent-child hierachy in a RadGrid, using an ADO DataSet object containing 2 tables, with a DataRelation already added to the DataSet, which should be enough to establish a parent-child relationship.
Here is dummy code that creates the DataSet:
DataTable dt1 = new DataTable();
DataTable dt2 = new DataTable();
DataSet ds = new DataSet();
DataRow myRow;
dt1.Columns.Add(
"Period");
dt1.Columns.Add(
"Period_Name");
dt2.Columns.Add(
"Period");
dt2.Columns.Add(
"File_Name");
dt2.Columns.Add(
"Size");
myRow = dt1.NewRow();
myRow[
"Period"] = "60";
myRow[
"Period_Name"] = "April 2011";
dt1.Rows.Add(myRow);
myRow = dt1.NewRow();
myRow[
"Period"] = "59";
myRow[
"Period_Name"] = "March 2011";
dt1.Rows.Add(myRow);
myRow = dt1.NewRow();
myRow[
"Period"] = "58";
myRow[
"Period_Name"] = "February 2011";
dt1.Rows.Add(myRow);
myRow = dt1.NewRow();
myRow[
"Period"] = "57";
myRow[
"Period_Name"] = "January 2011";
dt1.Rows.Add(myRow);
myRow = dt2.NewRow();
myRow[
"Period"] = "60";
myRow[
"File_Name"] = "User_60_123456_1.pdf";
myRow[
"Size"] = "923324";
dt2.Rows.Add(myRow);
myRow = dt2.NewRow();
myRow[
"Period"] = "60";
myRow[
"File_Name"] = "User_60_123456_2.pdf";
myRow[
"Size"] = "433324";
dt2.Rows.Add(myRow);
myRow = dt2.NewRow();
myRow[
"Period"] = "60";
myRow[
"File_Name"] = "User_60_123456_3.pdf";
myRow[
"Size"] = "693324";
dt2.Rows.Add(myRow);
ds.Tables.Add(dt1);
ds.Tables.Add(dt2);
DataRelation dRel = new DataRelation("Period_to_PDF", ds.Tables[0].Columns["Period"],
ds.Tables[1].Columns[
"Period"]);
ds.Relations.Add(dRel);
Table #1 (dt1) is the parent DataTable, containing "periods"
Table #2 (dt2) is the child DataTable containing "files relating to a period"
Only Period #60 has child rows in dt2 in this example.
HOW DO I USE THIS DATASET TO CREATE A HIERARCHICAL RADGRID???????????????????? IS IT EVEN POSSIBLE?
I would think that simply binding it to a grid would do it, but apprently RadGrid is not very smart, since it does not recognize the DataRelation object in the DataSet
(I yearn for the days of desktop grid control that handled all of that for you if you created a properly related dataset.