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
25
UltraGrid - Summary
posted

Hello, I am trying to sum a few different columns. Below is the code I am using. I got it working, but I cant seem to find the correct code to format the summary row. I want certain columns to be a number format, and the other ones to be currency.

private void UltraGridUMAFees_InitializeLayout(object sender, InitializeLayoutEventArgs e)
{
this.UltraGridUMAFees.DisplayLayout.Bands[0].Summaries.Add(SummaryType.Sum, this.UltraGridUMAFees.DisplayLayout.Bands[0].Columns["Accounts"]);
this.UltraGridUMAFees.DisplayLayout.Bands[0].Summaries.Add(SummaryType.Sum, this.UltraGridUMAFees.DisplayLayout.Bands[0].Columns["FeeReceived"]);
this.UltraGridUMAFees.DisplayLayout.Bands[0].Summaries.Add(SummaryType.Sum, this.UltraGridUMAFees.DisplayLayout.Bands[0].Columns["FeeExpected"]);
this.UltraGridUMAFees.DisplayLayout.Bands[0].Summaries.Add(SummaryType.Sum, this.UltraGridUMAFees.DisplayLayout.Bands[0].Columns["MarketValue"]);

}

Thanks!

Parents
  • 21795
    Verified Answer
    Offline posted

    Hello IT,

    Each time you add a Summary to a grid band the method returns SummarySettings object. To set the formatting of the summary you need to set DisplayFormat property of the returned SummarySttings. You can use code like this:

    var accountsSummarySettings = this.UltraGridUMAFees.DisplayLayout.Bands[0].Summaries.Add(
        SummaryType.Sum, this.UltraGridUMAFees.DisplayLayout.Bands[0].Columns["Accounts"]);
    accountsSummarySettings.DisplayFormat = "{0:C}";

    Additional information about SummarySettings.DisplayFormat you may find in our online documentation here.

    Please let me know if you have any additional questions on this matter.

Reply Children
No Data