[Solved] Tertiary layer on RadGridView

1 Answer 16 Views
GridView
Carl
Top achievements
Rank 1
Bronze
Iron
Iron
Carl asked on 15 Jul 2026, 08:06 PM

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

1 Answer, 1 is accepted

Sort by
0
Dinko | Tech Support Engineer
Telerik team
answered on 20 Jul 2026, 12:15 PM | edited on 20 Jul 2026, 12:15 PM

Hello Carl,

Thank you for contacting us and for the details you provided.

Upon reading the code, here is what you can try to fix this. Try calling the ToList() method of the data set on the DataSource. 

 

grid.DataSource = achTypeData.ToList();

 

Also, I see that the relation targeting DCType property is commented out. You can uncomment it and check again if this will make any difference:

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);
The above is just a suggestion as I don't have the data. If the above does not work, you can try to isolate it in a standalone project so that I can take a closer look and suggest a more suitable solution.

 

Regards,
Dinko | Tech Support Engineer
Progress Telerik

Modernizing a WinForms application? Use the AI-powered WinForms Converter to simplify migration to Telerik UI for WinForms.
Tags
GridView
Asked by
Carl
Top achievements
Rank 1
Bronze
Iron
Iron
Answers by
Dinko | Tech Support Engineer
Telerik team
Share this question
or