GridSummaryColumnDescription Format
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
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
SIGN IN To post a reply.
3 Replies
AD
Administrator
Syncfusion Team
January 23, 2007 04:42 PM UTC
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
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
NR
Navaneeth Rajkumar
January 23, 2007 05:16 PM UTC
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
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
AD
Administrator
Syncfusion Team
January 24, 2007 07:43 PM UTC
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
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
SIGN IN To post a reply.
- 3 Replies
- 2 Participants
-
NR Navaneeth Rajkumar
- Jan 22, 2007 08:10 PM UTC
- Jan 24, 2007 07:43 PM UTC