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


Trying to get a sort to work the way I need and am running into a problem. The column is of type Int64, contain's numeric data with a format specifier of N0. Why when sorted, is it sorting this data as text? Resulting in the sort doing something along the lines of... 1 1111 77 9 If my data were text, this would be fine, but it's not. What to do? Any suggestions?

4 Replies

AD Administrator Syncfusion Team August 3, 2003 04:54 PM UTC

Is this a GridDataBoundGrid? If so, try setting the CellValueType to typeof(Int64). You can do this either through the grid.GridBoundColumns if you have explicitly added them, or through the grid.Binder.InternalColumns if you haven't explicitly added gridboundcolumns.
this.grid.InternalColumns.StyleInfo.CellValueType = typeof(Int64);
If this is a GridControl, then make sure the grid.ColStyles[col].CellValueType is set to typeof(Int64).

RK Randy Kennison August 4, 2003 02:04 AM UTC

It's a gridControl. And I did set the value to Int64 through the designer. I also added it to the code, and even went so far as to set each cell ( just for giggles ) to a CellValueType of typeof( Int64 ). Does the same thing.I was convinced that it's looking at the "text" that is displayed in the grid instead, and seeing the ',' characters that the N0 format will create. So I removed that type from a column or 2, and I get the same behavior... So that's not it. This is driving me nutz at this point as I"m sure it's something so simple I'm overlooking.

RK Randy Kennison August 4, 2003 03:59 AM UTC

And... it was. I was using the PopulateValues call, and passing in a 3d array of strings. Apparently, that set's teh cell's ValueType to a string. Just currious, I tried to set the cells back to the correct type manually, called refresh, no change. I just had to create a custom class to hold the IList derived object, and stoped using the string [,] array to populate the list in mass.

AD Administrator Syncfusion Team August 4, 2003 05:28 AM UTC

Is this the code you tried after calling PopulateValues? this.grid.ColStyles[col].CellValueType = typeof(Int64); If this did not work, PopulateValues must have set the individual cells styles to string. So, if that is the case, try: GridStyleInfo style = new GridStyleInfo(); style.CellValueType = typeof(Int64); this.grid.ChangeCells(GridRangeInfo.Cells(1, col, this.grid.RowCount, col), style, Syncfusion.Styles.StyleModifyType.Override); to change the individual cell styles back.

Live Chat Icon For mobile
Up arrow icon