Welcome Guest Search | Active Topics | Sign In | Register

how to display a number and keep the function sorts in a EO.Web.Grid Options
COMSOFT-SOS DEVELOPERS
Posted: Monday, January 4, 2010 9:07:18 AM
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);
eo_support
Posted: Monday, January 4, 2010 9:13:57 AM
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!
COMSOFT-SOS DEVELOPERS
Posted: Monday, January 4, 2010 9:34:35 AM
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


You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.