|
Rank: Newbie Groups: Member
Joined: 9/7/2009 Posts: 4
|
Hello everybody, (and happy new year)
I would like to display in the column's grid a numbers (decimal (6,3)) in order to display zero at the beginning and end. For exemple "3.000". For this, I use a StaticColumn with a dataType is String. The problem is that the sort the column does not work. My question is how to display a number and keep the function sorts on my column?
Thank's for your help.
PS : I use this code : gc = new StaticColumn(); gc.DataField = "PACKAGING_CODE"; //column name in stored procedure gc.AllowSort = true; gc.DataType = GridColumnDataType.String; gvProductGroupCountry.Columns.Add(gc);
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,194
|
Hi,
Happy new year to you too! The Grid sorts by cell "Value", which can be different than what it displays if you set the columns' DataFormat property. So the easiest way is to use Float as your data type and then set DataFormat to format it the way you would like it to display.
Thanks!
|
|
Rank: Newbie Groups: Member
Joined: 9/7/2009 Posts: 4
|
Hi,
It's good, in my stored procedure my attribute is select like this: cast (PK.PACKAGING_CODE as float) as PACKAGING_CODE,
and for my grid, my column is defined like this : gc = new StaticColumn(); gc.DataField = Constants.Packaging.PACKAGING_CODE; gc.AllowSort = true; gc.DataType = GridColumnDataType.Float; gc.DataFormat = "{0:N3}"; gvProductGroupCountry.Columns.Add(gc);
And now it's work !! thank's very much. Bye
|
|