$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



<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.

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

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