0

I have a DevXpress grid display some information about geolocalization this including Longitude and Latitude, both columns are formated as Number "N5" but in latitude I have 45,xxxx and in latitude I have -73,xx I double checked generated code and DevXpress "WYSIWYG" but can't find anything.

The generated code:

// 
// colLatitude
// 
resources.ApplyResources(this.colLatitude, "colLatitude");
this.colLatitude.DisplayFormat.FormatString = "N5";
this.colLatitude.DisplayFormat.FormatType = DevExpress.Utils.FormatType.Numeric;
this.colLatitude.FieldName = "Latitude";
this.colLatitude.MinWidth = 50;
this.colLatitude.Name = "colLatitude";
this.colLatitude.OptionsColumn.AllowEdit = false;
this.colLatitude.OptionsColumn.AllowGroup = DevExpress.Utils.DefaultBoolean.False;
this.colLatitude.OptionsColumn.AllowSort = DevExpress.Utils.DefaultBoolean.False;
this.colLatitude.OptionsColumn.ReadOnly = true;


// 
// colLongitude
// 
resources.ApplyResources(this.colLongitude, "colLongitude");
this.colLongitude.DisplayFormat.FormatString = "N5";
this.colLongitude.DisplayFormat.FormatType = DevExpress.Utils.FormatType.Numeric;
this.colLongitude.FieldName = "Longitude";
this.colLongitude.MinWidth = 50;
this.colLongitude.Name = "colLongitude";
this.colLongitude.OptionsColumn.AllowEdit = false;
this.colLongitude.OptionsColumn.AllowGroup = DevExpress.Utils.DefaultBoolean.False;
this.colLongitude.OptionsColumn.AllowSort = DevExpress.Utils.DefaultBoolean.False;
this.colLongitude.OptionsColumn.ReadOnly = true;

code from the view's controller :

 /// <summary>
 /// Get la Latitude
 /// </summary>
 public double Latitude
 {
   get { return this.GPSEventData.Latitude; }
 }
 /// <summary>
 /// Get la Longitude
 /// </summary>
 public double Longitude
 {
   get { return this.GPSEventData.Longitude; }
 }
poudigne
  • 1,694
  • 3
  • 17
  • 40
  • have you tried setting the format type to `DevExpress.Utils.FormatType.Custom`? – Jens Kloster Mar 15 '13 at 13:33
  • Actualy, no because the format is good when > 0 – poudigne Mar 15 '13 at 14:24
  • This may just be a typo in your question, but you say that you are seeing one of the values as 45,xxxx. It only has 4 x's. If the formatting is working for numbers > 0 I would expect it to display as 45,xxxxx (5 x's), so maybe < 0 has nothing to do with it. – Stainy Mar 15 '13 at 15:00

1 Answers1

1

I'm assuming that the grid is bound to a datasource somehow, such as a DataTable.

Check the types of Latitude and Longitude in the datasource. If they are defined as string the formatting in the grid will not work.

Your values of 45,xxxx and -73,xx are formatted with commas, which makes me think they might be defined as string in the datasource.

If you're actually using the commas as a decimal mark, it might have something to do with localization settings. Take a look at this post: How to fix an application that has a problem with decimal separator

Community
  • 1
  • 1
Stainy
  • 450
  • 2
  • 8
  • I Edited my post with the code from the controller. both value are Double. – poudigne Mar 15 '13 at 13:32
  • I'm at a loss to think of anything else. I tried applying French culture specific settings and it worked for me. I assume that's what you are using - "Get la Latidtude" :-) – Stainy Mar 15 '13 at 14:45
  • One other thing. You could try setting the cell value yourself using `gridView1.SetRowCellValue(1, "colLatitude", -73.12345);` If that works you could at least narrow it down to only a problem with the bound values from the controller. – Stainy Mar 15 '13 at 15:15