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.

Formatting issue for summery row columns

Thread ID:

Created:

Updated:

Platform:

Replies:

71465 Jan 31,2008 02:36 PM Feb 5,2008 04:31 PM Windows Forms 3
loading
Tags: GridControl
Hareesh Bharadwaj
Asked On January 31, 2008 02:36 PM

Hi, I am using grid control in one of my application and also I have a summary row with a field, where
GridSummaryColumnDescriptor.Format = "{Sum}";
GridSummaryColumnDescriptor.SummaryType = Syncfusion.Grouping.SummaryType.DoubleAggregate;
The data in the column is decimal.

The summary row works fine, but I am having trouble to set the format of summery column. While i am trying to limit the decimal value by 2 using F2, it is working only if the cell type is of "Formula Cell".

Please advise.
Thank you
Hareesh


Sri Rajan [Syncfusion]
Replied On February 1, 2008 06:58 PM

Hi Hareesh,

Thank you for your interest in Syncfusion products.

To limit the decimal value by 2 using F2, You need to handle TableControlCurrentCellKeyDown and restrict the decimal value by 2 by setting the format using the code sd.Format = "{Sum: ##.#0}. Please refer the below code for more details.


private void gridGroupingControl1_TableControlCurrentCellKeyDown(object sender, GridTableControlKeyEventArgs e)
{
if (e.Inner.KeyCode == Keys.F2)
{
GridSummaryColumnDescriptor sd = new GridSummaryColumnDescriptor();
sd.DataMember = "Col2";
sd.DisplayColumn = "Col2";
sd.Format = "{Sum: ##.#0}";
sd.SummaryType = SummaryType.DoubleAggregate;
this.gridGroupingControl1.TableDescriptor.SummaryRows.Add(new GridSummaryRowDescriptor("Col2", "Sum :", sd));
sd.Appearance.AnyCell.HorizontalAlignment = GridHorizontalAlignment.Left;
}
}


Please refer to the attached sample for more details.
http://websamples.syncfusion.com/samples/Grid.Windows/71465/main.htm

Please let me know if this helps.

Regards,
Srirajan


Hareesh Bharadwaj
Replied On February 4, 2008 10:56 AM

Hi SriRajan

Thank you, for your kind help. We tried that solution here now we are able to limit the summery column value. By setting the following formats we are able to limit the summery column values.
{Sum:##.#0} – Display will be 123.12
{Sum:f2} – Display will be 123.12
{Sum:f3} – Display will be 123.123
{Sum:c3}– Display will be $123.123 etc
But still there are some issues.
When we tried to set the summery row column for “Double Aggregate Type” as D (Decimal type), X (Hexa decimal), T (Truncated) etc then the summery row gets disappeared.
EX {Sum:D}
It will be very much helpful for me if you suggest any solution regarding this.

Regards
Hareesh


>Hi Hareesh,

Thank you for your interest in Syncfusion products.

To limit the decimal value by 2 using F2, You need to handle TableControlCurrentCellKeyDown and restrict the decimal value by 2 by setting the format using the code sd.Format = "{Sum: ##.#0}. Please refer the below code for more details.


private void gridGroupingControl1_TableControlCurrentCellKeyDown(object sender, GridTableControlKeyEventArgs e)
{
if (e.Inner.KeyCode == Keys.F2)
{
GridSummaryColumnDescriptor sd = new GridSummaryColumnDescriptor();
sd.DataMember = "Col2";
sd.DisplayColumn = "Col2";
sd.Format = "{Sum: ##.#0}";
sd.SummaryType = SummaryType.DoubleAggregate;
this.gridGroupingControl1.TableDescriptor.SummaryRows.Add(new GridSummaryRowDescriptor("Col2", "Sum :", sd));
sd.Appearance.AnyCell.HorizontalAlignment = GridHorizontalAlignment.Left;
}
}


Please refer to the attached sample for more details.
http://websamples.syncfusion.com/samples/Grid.Windows/71465/main.htm

Please let me know if this helps.

Regards,
Srirajan




Sri Rajan [Syncfusion]
Replied On February 5, 2008 04:31 PM

Hi Hareesh,

Thank your for your continued interest in Syncfusion products.

Please refer to the attached sample, that will help you to set the summery row column for “Double Aggregate Type” as D (Decimal type), X (Hexa decimal), T (Truncated) etc


void gridGroupingControl1_TableControlDrawCellDisplayText(object sender, GridTableControlDrawCellDisplayTextEventArgs e)
{
Element el = this.gridGroupingControl1.Table.DisplayElements[e.Inner.RowIndex];
int col = this.gridGroupingControl1.TableDescriptor.ColIndexToField(e.Inner.ColIndex);
string column = this.gridGroupingControl1.TableDescriptor.Columns[col].Name;
if ((el.Kind == DisplayElementKind.Summary && column == "Col2"))
{

int iSum = Convert.ToInt32(e.Inner.Style.CellValue);
e.Inner.DisplayText = string.Format("{0:x}", iSum);
}
}


Please refer to the attached sample for more details.
http://websamples.syncfusion.com/samples/Grid.Windows/71465/Modified_summary.zip

Please let me know if this helps.

Regards,
Srirajan



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.

;