I am having a problem with trying to set summation summaries on just the columns in the for loop. It sets them, however, I somehow get 2 rows of of grand totals. My code is below. If I don't use my code then it does give me the one grand total line. Also, I don't want to have summaries on any of my other columns, but the AllowRowSummaries.BasedOnDataType turn that on for the other ones as well. Can I prevent that?
Here is a picture and some text explaining when that happens.
http://i247.photobucket.com/albums/gg152/peryan77/repeattotals.jpg
private void ultraGridSales_InitializeLayout(object sender, InitializeLayoutEventArgs e)
{
//Set Sum on Sales Columns
e.Layout.Override.AllowRowSummaries = AllowRowSummaries.BasedOnDataType;
for (int i = 5; i < ColumnCount; i++)
//Format
band.Columns.Format = "$#,##0.00";
band.Columns.CellAppearance.TextHAlign = Infragistics.Win.HAlign.Right;
//Summaries
band.Summaries.Add(SummaryType.Sum,band.Columns);
}}
My guess is that InitializeLayout is firing twice. You should check to make sure the summaries do not already exists before you add any.
Summaries is a collection just like any other. So you could check band.Summaries.Count > 0