HI, I have a data grid with 100's of rows of data and about 50 columns. Every row will not have data for each column, in certain cases the first row on the grid will not have values for all 50 columns, in this scenario I see that the format I apply to that column is not applied to any of the cells on the rest of the rows.
For example say I applied a Format of "#,###.##" to column C, as Row 1 does not have a value for column C, the values for Column C in Row 2 and 3 are not formatted correctly.
Column A Column B Column C
Row 1 10.54 15.69Row 2 1.28 3.23 2.666666666 Row 3 9.26 1.25 3.1333333333
I'm using version 10.2 of the UltraGrid, I have tried an older version as well and I see the same issues, any advice?
Thanks
Hi,
I've never heard of this kind of thing happening before. It certainly should not make any difference what the first cell value is.
In what event are you applying the Format?
What kind of DataSource are you using?
Are you sure it's the lack of a value in the first row and not some other factor at work here? Is the DataType of the column(s) numeric?
Can you reproduce this issue in a small sample project?
Thanks for the reply.
Mike Saltzman"]In what event are you applying the Format?
I am applying the formatting in initialiseLayout, it works fine for all columns apart from the ones where the first row doesn't have any data.
Mike Saltzman"]What kind of DataSource are you using?
A list of Custom objects (that implement ICustomTypeDescriptor)
Mike Saltzman"]Are you sure it's the lack of a value in the first row and not some other factor at work here? Is the DataType of the column(s) numeric?
I think I have narrowed it down to this, the data type it returns for these columns is double.
I don't have a simple app, let me see if I can put something together.
There's no reason I can think of why this would happen for a double column. If you can post a sample, I will be happy to take a look at it and check it out.
You might want to set Visual Studio to break on all run-time exceptions - just to see if maybe an exception is occurring and getting caught.
Hey,
I think I figured this one out, I think its because I was returning the type of data as string for any properties on a row that didn't have a value (translates to a cell on a grid), my data structure would correctly return double as the property type if the object had a value.
If the first row in a band had no value for a particular property my data structure would return type of string and I think the grid would assume that property was of type string for every object at that band.
Thanks for your help..
That makes sense. The way the Format property on the grid works is that it calls the ToString method on the cell's value and passes in the format. The string datatype in DotNet does not support any formatting.