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

Problem with SortCommand and empty value with the RadGrid

1 Answer 177 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Hans
Top achievements
Rank 1
Hans asked on 09 Dec 2013, 08:18 PM

Hello,

I have a problem with the custom sort in Oracle data base with a empty string and your RadGrid. When I use a custom sort in your RadGrid, the object result list it’s ok, but in the grid, the result isn’t the same. But, if I use buttons to sort the grid with the same query, the result it’s correct in my grid. I think the grid sort again my objects list in the SortCommand.

In Sql server, I have no problem with the same query. In Oracle, the empty value isn’t sort of the same order as  Sql Server. But why the grid sorts again my list of objects ?

Exemple code for custom sort :

Private Sub grdDetailTelerik_SortCommand(sender As Object, e As Telerik.Web.UI.GridSortCommandEventArgs) Handles grdDetailTelerik.SortCommand
    Dim sortingField As String = e.SortExpression
    Dim sortingOrder As String = e.NewSortOrder
    ActualResultPage = 0
    SetLastViewPage(0)
    SortColumn = sortingField
    SortDirection = sortingOrder
    grdDetailTelerik.DataSource = GetData(True) 'Get all of objet with my query
    grdDetailTelerik.Rebind()
End Sub


Custom sort :

SortColumn = Code

SortDirection = Ascending


Result list of Objet(Oracle) :         

Code = 001.0.0

Code = 001.0.0

Code = 001.0.0

Code = 001.0.0

Code = 001.0.0

Code = 001.0.0

Code = 001.0.0

Code = 099.9.0

Code = 099.9.0

Code = String.empty

Code = String.empty


Result list of Objet (Sql Server) :

Code = String.empty

Code = String.empty

Code = 001.0.0

Code = 001.0.0

Code = 001.0.0

Code = 001.0.0

Code = 001.0.0

Code = 001.0.0

Code = 001.0.0

Code = 099.9.0

Code = 099.9.0

Result in grid(Oracle), the order of sort isn’t ok in this example, my empty string is in top, but  :
Page 1 :
oracle_page1.png

Page 2 :
oracle_page2.png


Result in grid (Sql server) is ok:

Page 1 : sql_page1.png

Page 2 :
sql_page2.png


Sorry but I can not give you the entire code, I only submiting the list of objects and the result in the grid.


If you need another example, I will provide you, if it's possible

Thank's in advance !!

1 Answer, 1 is accepted

Sort by
0
Pavlina
Telerik team
answered on 13 Dec 2013, 06:16 AM
Hello Hans,

Can you please check whether the same behavior appear when binding your Oracle data base to regular MS GridView control? Also  make sure that AllowCustomSorting property is set to true in the MasterTableView which is required when you want to apply your custom sort criteria.

Additionally, I recommend you check the online resources below for more information on how to apply custom sort criteria for the grid and let me know if they help:
http://www.telerik.com/help/aspnet-ajax/grid-apply-custom-sort-criteria.html
http://demos.telerik.com/aspnet-ajax/grid/examples/functionality/sorting/custom-sorting/defaultcs.aspx

Regards,
Pavlina
Telerik
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to the blog feed now.
Tags
Grid
Asked by
Hans
Top achievements
Rank 1
Answers by
Pavlina
Telerik team
Share this question
or