This is a migrated thread and some comments may be shown as answers.

rad grid column sorting does not seem to work correctly for the last column in the grid

7 Answers 91 Views
Grid
This is a migrated thread and some comments may be shown as answers.
ertet
Top achievements
Rank 1
ertet asked on 18 Oct 2010, 06:50 PM
i am using rad grid and in the rad grid last column(total) sorting is not happening correctly. it is sorting from second record. for ex the output should be
$989.23
 $1099.81
$1799.12
$1988.45

but it is showing

 $1099.81
$1799.12
$1988.45
$989.23

I have added sort expression and also in page load i have given in page_load, all other columns sorting is working fine and this result is coming from database

            GridSortExpression expression = new GridSortExpression();
            expression.FieldName = "total";
            expression.SortOrder = GridSortOrder.Ascending;
            grdResults.MasterTableView.SortExpressions.AddSortExpression(expression);
            grdResults.MasterTableView.Rebind();
            this.grdResults.AllowSorting = true;

7 Answers, 1 is accepted

Sort by
0
Cori
Top achievements
Rank 2
answered on 18 Oct 2010, 08:10 PM
Have you set the DataType property for that column to a numeric one? That could be the issue.
0
ertet
Top achievements
Rank 1
answered on 18 Oct 2010, 08:21 PM
Is it mandatory to change it to numeric as i have its datatype as system.decimal, will decimal or double work??
0
ertet
Top achievements
Rank 1
answered on 19 Oct 2010, 01:54 PM
dataformat string is not working at all for currency format. i have given

 

<rad:GridBoundColumn DataField="fuel" DataFormatString="{0:$###,###.00}" HeaderButtonType="TextButton"

 

 

HeaderText="Fuel" ReadOnly="true" SortExpression="fuel" UniqueName="fuel" Visible="true">

 

 

<HeaderStyle HorizontalAlign="Right" />

 

 

<ItemStyle HorizontalAlign="Right" />

 

 

</rad:GridBoundColumn>

 

 

<rad:GridBoundColumn DataField="total" HeaderButtonType="TextButton" DataFormatString="{0:$###,####.00}"

 

 

HeaderText="Total" DataType="System.Decimal" AllowSorting="true" ReadOnly="true"

 

 

SortExpression="total" UniqueName="total" Visible="true">

 

 

<HeaderStyle HorizontalAlign="Right" />

 

 

<ItemStyle HorizontalAlign="Right" />

 

 

</rad:GridBoundColumn>

 


but still the format doesnt come, i have to hardcode it to

 

row["total"] = (row["fuel"].ToString() + row["mRate"].ToString());

 

 

row["fuel"] = "$" + row["fuel"].ToString();

 

 

row["total"] = "$" + row["total"].ToString();

so wen i do a sorting,it doesnt happen corectly.please advice.

 

0
ertet
Top achievements
Rank 1
answered on 21 Oct 2010, 03:16 PM
Is there nobody to fix this issuee????
0
Nikolay Rusev
Telerik team
answered on 22 Oct 2010, 12:25 PM
Hello Ertet,

RadGrid performs String.Format("value extracted from DataItem","specified format") when you specify DataFormatString.

You can try manually applying your custom format you some value that is used for binding RadGrid and see whether it is formatted as you expect.

Regards,
Nikolay
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
ertet
Top achievements
Rank 1
answered on 22 Oct 2010, 03:54 PM
it is not working, problem is with sorting............not sorting alsooo....
0
Nikolay Rusev
Telerik team
answered on 26 Oct 2010, 10:52 AM
Hi Ertet,

If String.Format("value extracted from DataItem","specified format") does not work properly, neither DataFormatString will work.

Regards,
Nikolay
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Tags
Grid
Asked by
ertet
Top achievements
Rank 1
Answers by
Cori
Top achievements
Rank 2
ertet
Top achievements
Rank 1
Nikolay Rusev
Telerik team
Share this question
or