I built a grid that has three levels as per the code below and I get this UI:
There should be data under the Card and Other/Basic rows but it doesn't show. I've done this successfully with other grids but something seems to be missing in this case.
The top level data looks like this:
The second level looks like this:
and the 3rd layer data looks like this:
private void SetupGrid(RadGridView grid,
List<ACHElectronicPayments>? achData)
{
grid.MasterTemplate.AutoGenerateColumns = true;
grid.MasterTemplate.ReadOnly = true;
var achTypeData = achData
.GroupBy(p => p.Type)
.Select(group => new
{
Type = group.Key,
AmountCollected = group.Sum(n => n.AmountCollected),
ReturnAmount = group.Sum(n => n.ReturnAmount),
Deposit = group.Sum(n => n.Deposit)
});
GridViewTemplate template2 = new GridViewTemplate();
template2.AutoGenerateColumns = true;
template2.DataSource = achData;
template2.AllowAddNewRow = false;
template2.ReadOnly = true;
template1.Templates.Add(template2);
GridViewRelation relation2 = new GridViewRelation(template1);
relation2.ChildTemplate = template2;
relation2.RelationName = "TypeDCType";
relation2.ParentColumnNames.Add("Type");
//relation2.ParentColumnNames.Add("DCType");
relation2.ChildColumnNames.Add("Type");
//relation2.ChildColumnNames.Add("DCType");
grid.Relations.Add(relation2);
}
grid.DataSource = achTypeData;
grid.MasterTemplate.Columns["Type"].Width = 100;
grid.MasterTemplate.Columns["Type"].HeaderText = "Type";
grid.MasterTemplate.Columns["Type"].HeaderTextAlignment = ContentAlignment.MiddleLeft;
grid.MasterTemplate.Columns["AmountCollected"].Width = 100;
grid.MasterTemplate.Columns["AmountCollected"].HeaderText = "Amount Collected";
grid.MasterTemplate.Columns["AmountCollected"].HeaderTextAlignment = ContentAlignment.MiddleRight;
grid.MasterTemplate.Columns["AmountCollected"].FormatString = "{0:#,##0.00}";
grid.MasterTemplate.Columns["ReturnAmount"].Width = 80;
grid.MasterTemplate.Columns["ReturnAmount"].HeaderText = "Return Amount";
grid.MasterTemplate.Columns["ReturnAmount"].HeaderTextAlignment = ContentAlignment.MiddleRight;
grid.MasterTemplate.Columns["ReturnAmount"].FormatString = "{0:#,##0.00}";
grid.MasterTemplate.Columns["Deposit"].Width = 90;
grid.MasterTemplate.Columns["Deposit"].HeaderText = "Deposit";
grid.MasterTemplate.Columns["Deposit"].HeaderTextAlignment = ContentAlignment.MiddleRight;
grid.MasterTemplate.Columns["Deposit"].FormatString = "{0:#,##0.00}";
grid.MasterTemplate.Templates[0].Columns["Type"].IsVisible = false;
grid.MasterTemplate.Templates[0].Columns["DCType"].Width = 120;
grid.MasterTemplate.Templates[0].Columns["DCType"].HeaderText = string.Empty;
grid.MasterTemplate.Templates[0].Columns["DCType"].HeaderTextAlignment = ContentAlignment.MiddleLeft;
grid.MasterTemplate.Templates[0].Columns["AmountCollected"].Width = 100;
grid.MasterTemplate.Templates[0].Columns["AmountCollected"].HeaderText = string.Empty;
grid.MasterTemplate.Templates[0].Columns["AmountCollected"].FormatString = "{0:#,##0.00}";
grid.MasterTemplate.Templates[0].Columns["ReturnAmount"].Width = 120;
grid.MasterTemplate.Templates[0].Columns["ReturnAmount"].HeaderText = string.Empty;
grid.MasterTemplate.Templates[0].Columns["ReturnAmount"].FormatString = "{0:#,##0.00}";
grid.MasterTemplate.Templates[0].Columns["Deposit"].Width = 120;
grid.MasterTemplate.Templates[0].Columns["Deposit"].HeaderText = string.Empty;
grid.MasterTemplate.Templates[0].Columns["Deposit"].FormatString = "{0:#,##0.00}";
//return;
grid.MasterTemplate.Templates[0].Templates[0].Columns["Type"].IsVisible = false;
grid.MasterTemplate.Templates[0].Templates[0].Columns["PaymentType"].Width = 100;
grid.MasterTemplate.Templates[0].Templates[0].Columns["PaymentType"].HeaderTextAlignment = ContentAlignment.MiddleLeft;
grid.MasterTemplate.Templates[0].Templates[0].Columns["EpayGLNumber"].Width = 100;
grid.MasterTemplate.Templates[0].Templates[0].Columns["EpayGLNumber"].HeaderTextAlignment = ContentAlignment.MiddleLeft;
grid.MasterTemplate.Templates[0].Templates[0].Columns["BankAccount"].Width = 100;
grid.MasterTemplate.Templates[0].Templates[0].Columns["BankAccount"].HeaderTextAlignment = ContentAlignment.MiddleLeft;
grid.MasterTemplate.Templates[0].Templates[0].Columns["AmountCollected"].Width = 100;
grid.MasterTemplate.Templates[0].Templates[0].Columns["AmountCollected"].FormatString = "{0:#,##0.00}";
grid.MasterTemplate.Templates[0].Templates[0].Columns["ReturnAmount"].Width = 120;
grid.MasterTemplate.Templates[0].Templates[0].Columns["ReturnAmount"].Width = 120;
grid.MasterTemplate.Templates[0].Templates[0].Columns["ReturnAmount"].FormatString = "{0:#,##0.00}";
grid.MasterTemplate.Templates[0].Templates[0].Columns["Deposit"].Width = 120;
grid.MasterTemplate.Templates[0].Templates[0].Columns["Deposit"].FormatString = "{0:#,##0.00}";
}What am I missing?
Thanks
Carl