How to set custom formating for GGC cell.

How do i format values in specific column. Now am doing some thing like this in QueryCellStyleInfo event

void _gridGroupingControl_QueryCellStyleInfo(object sender, GridTableCellStyleInfoEventArgs e)
{
if (e.TableCellIdentity.Column.Name.Equals("Amount"))
{
e.Style.CellType = "Currency";
}
}

which ends up displaying the values as $2,345.00 or ($2,345.00) if its a negative amount.

What i need is to display the the value as 2,345.00 or -2,345.00 if its a negatiove value.

How can i do this?





1 Reply

RC Rajadurai C Syncfusion Team October 13, 2008 12:09 PM UTC

Hi Deva,

Thanks for your interest in Syncfusion products.

To achieve this feature, you can use the GridStyleInfo.CurrencyEdit properties in QueryCellStyleInfo event handler. Given below is a sample code snippet.


private void gridGroupingControl1_QueryCellStyleInfo(object sender,GridTableCellStyleInfoEventArgs e)
{
if(e.TableCellIdentity.ColIndex == 4 && e.TableCellIdentity.RowIndex > 1)
{
e.Style.CellType = "Currency";
e.Style.CurrencyEdit.CurrencySymbol = "";
e.Style.CurrencyEdit.NegativeSign = "-";
e.Style.CurrencyEdit.CurrencyNegativePattern = 1;
e.Style.CurrencyEdit.NegativeColor = Color.Black;
}
}


Please check out the sample here.
GGC-77050.zip



Loader.
Up arrow icon