We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.

GridSummaryColumnDescription Format

Thread ID:

Created:

Updated:

Platform:

Replies:

55021 Jan 22,2007 03:10 PM Jan 24,2007 02:43 PM Windows Forms 3
loading
Tags: Grouping
Navaneeth Rajkumar
Asked On January 22, 2007 03:10 PM

Hi,
I am using the GridSummarycolumnDescription to sum up the columns in my GGC. I would like to specify the format in which the summary should be displayed. $1000000.00 as $1,000,000.00, $-1000 as $(1,000)(in red) etc... the below is the code that I am currently using..

GridSummaryColumnDescriptor total_summary = new GridSummaryColumnDescriptor();
total_summary.DataMember = "Test";
total_summary.DisplayColumn = "Test";
total_summary.Format = "{Sum:#.00}";
total_summary.SummaryType = SummaryType.DoubleAggregate;

Thanks

Administrator [Syncfusion]
Replied On January 23, 2007 11:42 AM

Hi Navaneeth,

Thanks for being patience.

This can be achieved by changing the Format and Appearance property of the summary column accordingly. The following is the code snippet.
>>>>>>>> Code Snippet <<<<<<<<<
total_summary.Format = "{Sum:$0,0.00}";
total_summary.Appearance.SummaryFieldCell.TextColor = Color.Red;
>>>>>>>>>>>>>><<<<<<<<<<<<<<<

Kindly let us know if you need any further assistance.
Have a nice day.

Best regards,
Madhan


Navaneeth Rajkumar
Replied On January 23, 2007 12:16 PM

Madhan,
Thanks for your reply. The text color is supposed to be red only if the sum is negative. So is there a way to capture the sum and check for its value? or is there a property which does that?

Thanks

>Hi Navaneeth,

Thanks for being patience.

This can be achieved by changing the Format and Appearance property of the summary column accordingly. The following is the code snippet.
>>>>>>>> Code Snippet <<<<<<<<<
total_summary.Format = "{Sum:$0,0.00}";
total_summary.Appearance.SummaryFieldCell.TextColor = Color.Red;
>>>>>>>>>>>>>><<<<<<<<<<<<<<<

Kindly let us know if you need any further assistance.
Have a nice day.

Best regards,
Madhan


Administrator [Syncfusion]
Replied On January 24, 2007 02:43 PM

Hi Navaneeth,

Thank you for being patience.

Please refer to the following code snippet which demonstrates the way to achieve the intend behavior by using the QueryCellStyleInfo event.

>>>>>>>>>>>>>>>>>>>>>>>
void gridGroupingControl1_QueryCellStyleInfo(object sender, Syncfusion.Windows.Forms.Grid.Grouping.GridTableCellStyleInfoEventArgs e)
{
if (e.TableCellIdentity.TableCellType == Syncfusion.Windows.Forms.Grid.Grouping.GridTableCellType.SummaryFieldCell)
{
if( e.TableCellIdentity.SummaryColumn.Name == "Lost")
{
GridTable table = e.TableCellIdentity.Table;
GridSummaryRow row = e.TableCellIdentity.DisplayElement as GridSummaryRow;
GridSummaryRowDescriptor summaryRowDescriptor = row.SummaryRowDescriptor;
GridSummaryColumnDescriptor sumCol1 = summaryRowDescriptor.SummaryColumns["Lost"];
if (sumCol1 != null)
{
string text1 = sumCol1.GetDisplayText(table, row);

System.Globalization.CultureInfo culture = table.Appearance.AnyCell.GetCulture(true);
double d1;
if (double.TryParse(text1, System.Globalization.NumberStyles.Any, culture, out d1))
{
if (d1 < 0)
e.Style.TextColor = Color.Red;
}
}
}
}
}
>>>>>>>>>>>>>>>>>>>>>>>

Kindly let us know if you need any further assistance.
Have a nice day.

Best regards,
Madhan

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;