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. Image for the cookie policy date
close icon

Default format issue

I am able to perform formatting for SummaryRowColumn, using "{Sum:f2}" such type format. But the problem is if i am setting
null in DataType Format then the format goes such a way {Sum:} and the SummaryRowColumn has seen in the earlier format.I need to set
my summaryrowcolumn value corresponding to the values in the column(Default format).

Please help me


3 Replies

JS Jeba S Syncfusion Team February 6, 2008 06:12 AM UTC

Hi Manjesh,

Sorry for the delay in response.

You can apply the same format of the column to the SummaryRowColumn by handling the QueryCellStyleInfo event handler. In the event handler get the format of the column using the GridColumnDescriptor and assign that format to the summary row.


private void gridGroupingControl1_QueryCellStyleInfo(object sender, Syncfusion.Windows.Forms.Grid.Grouping.GridTableCellStyleInfoEventArgs e)
{
GridTableCellStyleInfoIdentity id = e.TableCellIdentity;
if (id.DisplayElement.Kind == DisplayElementKind.Summary )
{
if (id.SummaryColumn != null
&& id.SummaryColumn.Name == "Sum2")
{
GridTableDescriptor td = e.TableCellIdentity.Table.TableDescriptor as GridTableDescriptor;
GridColumnDescriptor cd = td.Columns[id.SummaryColumn.DisplayColumn];
string format = "{0:" + cd.Appearance.AnyRecordFieldCell.Format + "}";
int iCellValue = Convert.ToInt32(e.Style.CellValue);
e.Style.Text = string.Format(format, iCellValue);
}
}
}


Please refer the sample and let us know if this helps.
http://websamples.syncfusion.com/samples/Grid.Windows/F71506/main.htm

Regards,
Jeba.



MA Manjesh.P.M February 11, 2008 11:37 AM UTC

Thanks a lot for your detailed clarification,
Sorry to tolerate u,

Once again thanks a lotttt



JS Jeba S Syncfusion Team February 11, 2008 01:02 PM UTC

Hi Manjesh,

Thank you for your update.

Regards,
Jeba


Loader.
Live Chat Icon For mobile
Up arrow icon