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

Display values with different currency symbols in a column.

Hi,

Is there a way for different currency symbol to be displayed in a single column?

Currently, I am using a DataView as the DataSource of the a GridDataBoundGrid. The records consist of different values in $, £ and ¥.

If I set its GridBoundColumn.StyleInfo.CellType to 'Currency', it only managed to display those records in which are in $.

By changing the GridBoundColumn.StyleInfo.CellType to TextBox, all records are displayed with it's own currency symbols.
However, CurrencyEdit styles can no longer apply to the cells and the sorting doesn't work properly due to the currency symbol.

Thanks in advance.

1 Reply

JS Jeba S Syncfusion Team September 25, 2007 05:29 AM UTC

Hi Alex,

Thank you for posting query to us.

You can achieve different currency symbol in a single column by handling the PrepareViewStyleInfo. In the event handler check the respective currency column and the RowIndex and set the Style.CurrencyEdit.CurrencySymbol property.

Please refer this code snippets:

private void gridDataBoundGrid1_PrepareViewStyleInfo(object sender, Syncfusion.Windows.Forms.Grid.GridPrepareViewStyleInfoEventArgs e)
{
if(e.ColIndex==3 && e.RowIndex==1)
{
e.Style.CellType="Currency";
e.Style.CellValueType=typeof(double);
e.Style.CurrencyEdit.CurrencySymbol="$";
}
if (e.ColIndex == 3 && e.RowIndex == 2)
{
e.Style.CellType = "Currency";
e.Style.CellValueType = typeof(double);
e.Style.CurrencyEdit.CurrencySymbol = "£";
}
if (e.ColIndex == 3 && e.RowIndex == 3)
{
e.Style.CellType = "Currency";
e.Style.CellValueType = typeof(double);
e.Style.CurrencyEdit.CurrencySymbol = "¥";
}
}

Please refer the sample which illustrates the above said feature:
http://websamples.syncfusion.com/samples/Grid.Windows/F68554/main.htm

Kindly let us know if you need any further assistance.

Thank you for using Syncfusion Products.

Best Regards,
Jeba.


Loader.
Live Chat Icon For mobile
Up arrow icon