0

I'm having issues displaying data with the currency symbol in a Developer Express XtraGrid control.

The column(s) in questions are float and decimal data types.

Basically it seems to be ignoring formatting when

...either set through the designer...

Select the "Main" section on the Left Click "Columns" Add my columns, to each one setting the Fieldname , then Display Format : DisplayFormat / FormatString = c2 DisplayFormat / FormatType = Numeric

...and also at runtime..

DevExpress.Utils.FormatInfo fi = new DevExpress.Utils.FormatInfo();
fi.FormatType = DevExpress.Utils.FormatType.Numeric;
fi.FormatString = "c2";
gridColumn3.DisplayFormat.Assign(fi); //Denomination
gridColumn5.DisplayFormat.Assign(fi); //Value

Neither has any effect whatso ever.

I notice someone else had what seems to be the same issue here on the devexpress site: http://www.devexpress.com/Support/Center/p/Q302261.aspx

The sample project provioded by Ted works fine this end, and when I change the DisplayFormat to Numeric "c2" this shows the currentcy symbol as I would like

Thinking that it's a strange property that has been set somewhere in the XtraGrid, I've added a brand new one to the form, setting nothing other than the columns to populate, and the DisplayFormat as described above.

Still no Luck.

Any ideas? Many thanks

Fetchez la vache
  • 4,940
  • 4
  • 36
  • 55
  • Wish I could help, but I tried exactly what you did and it works fine here on DexExpress 11.2.11. Have you tried starting with a brand new solution? Taking things a step farther, (and this is really a stretch, but...) perhaps a reinstall of DevExpress? – kenrogers Jun 01 '12 at 14:27

1 Answers1

0

I've given up using the designer. Hardcoding it the long way seems to work. Welcome back to 1987...

Fetchez la vache
  • 4,940
  • 4
  • 36
  • 55
  • Why don't you contact the DX guys regarding your issue? – Mikhail Jun 04 '12 at 16:45
  • Hi Mikhail. I did, and their response was to use GridColumn.DisplayFormat which I'd explained wasn't working in my instance, though I could create a brand new test project where it would work fine. There's always a time constraint on issues (mine included getting something fixed before taking a week off - also hence my late comment on this) so the only solution to me was to forget the designer altogether and hard code it, which worked for me. Cheers :) – Fetchez la vache Jun 12 '12 at 10:00
  • NB I've just marked my "forget it and hard-code it" answer as the answer, as it was the only one that worked for me. If this is not the thing to do, please let me know. Ta. – Fetchez la vache Jun 12 '12 at 10:02
  • I found out that they use internal format and you need to have the string set like "{0:} "{0:" + gridColumn.DisplayFormat.FormatString + "}"; – Boris Kleynbok Mar 24 '17 at 18:08