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
1059
Add Grand Total to Ultragrid
posted

Hi,

How do i add grand total to the ultragrid?

I am using the following code but it doesnt seem to show the grand total.

 

UltraGridBand band = sGridName.DisplayLayout.Bands[0];

sGridName.DisplayLayout.Bands[0].Columns[sColName].AllowRowSummaries =AllowRowSummaries.True;

SummarySettings SumSummary = band.Summaries.Add("Sum " + sColName, SummaryType.Sum, band.Columns[sColName]);

SumSummary.DisplayFormat ="{0:#,##0.00}";

SumSummary.Appearance.TextHAlign =HAlign.Right;

SumSummary.SummaryDisplayArea |=SummaryDisplayAreas.Bottom;

//sGridName.DisplayLayout.Override.SummaryDisplayArea = SummaryDisplayAreas.Bottom;

 band.SummaryFooterCaption ="Subtotal:";

 band.Override.SummaryFooterCaptionAppearance.FontData.Bold =DefaultableBoolean.True;

band.Override.SummaryFooterCaptionAppearance.BackColor =Color.LightSteelBlue;

band.Override.SummaryFooterCaptionAppearance.ForeColor =Color.Black;          

// Here, I want to add grand total

UltraGridColumn columnToSummarize = band.Layout.Bands[0].Columns[sColName];      

SummarySettings summary = band.Layout.Bands[0].Summaries.Add("Grand Total For "+sColName, SummaryType.Sum, columnToSummarize);

summary.DisplayFormat ="{0:#,##0.00}";

summary.SummaryDisplayArea |=SummaryDisplayAreas.GroupByRowsFooter;

summary.Appearance.TextHAlign =HAlign.Right;       

// Disable grid default highlight

sGridName.DisplayLayout.Override.ResetActiveRowAppearance();

sGridName.DisplayLayout.Override.ResetActiveCellAppearance();

sGridName.DisplayLayout.Override.ActiveAppearancesEnabled =DefaultableBoolean.False;

Thanks