Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
1187
How to add a row to my header to showing grouping of columns
posted

I have a grid with the following 7 columns: name, cnt_a, tot_a, avg_a, cnt_b, tot_b, avg_b

I want to add a row to my header above my current column header to show a grouping of the 'a' columns and the 'b' columns.  Is there a sample somewhere to show how I can do this?

 

Currently my header looks like this:

| Name                                 | cnt_a | tot_a | avg_a | cnt_b | tot_b | avg_b |

 

I would like my header to look like this:

|----------------------------------| A                     | B                    |

| Name                                 | cnt | tot | avg | cnt | tot | avg |

 

Parents
  • 469350
    Suggested Answer
    Offline posted

    Hi,

    There's nothing to it. :)

     


            private void ultraGrid1_InitializeLayout(object sender, Infragistics.Win.UltraWinGrid.InitializeLayoutEventArgs e)
            {
                UltraGridLayout layout = e.Layout;
                UltraGridBand rootBand = layout.Bands[0];

                if (rootBand.Groups.Exists("A") == false)
                {
                    UltraGridGroup group = rootBand.Groups.Add("A");
                    rootBand.Columns["Key"].Group = group;
                }

                if (rootBand.Groups.Exists("B") == false)
                {
                    UltraGridGroup group = rootBand.Groups.Add("B");
                    rootBand.Columns["String 1"].Group = group;
                    rootBand.Columns["String 2"].Group = group;
                    rootBand.Columns["Int32 1"].Group = group;
                    rootBand.Columns["Int32 2"].Group = group;
                }           
            }

Reply Children