Handling Null Values when Sorting

8 posts, 0 answers
  1. ColinBowern
    ColinBowern avatar
    51 posts
    Member since:
    Aug 2012

    Posted 14 Jul 2010 Link to this post

    One of our testers just caught an issue with RadGrid where Oracle is returning the data set sorting NULL values last.  RadGrid, however, is positioning null values first.  It appers to be an option on the Oracle side that can be controlled.  In our app I think the thing that makes sense is to sort the null's last.  Is it possible to modify the RadGrid behavior to treat NULL values in this manner?

    Thanks,
    Colin
  2. Iana Tsolova
    Admin
    Iana Tsolova avatar
    3388 posts

    Posted 19 Jul 2010 Link to this post

    Hi Colin,

    You can try setting the EnableLinqExpressions property of the grid to false and see if it makes any difference.

    Additionally, in order to achieve your goal, I would suggest that you implement custom sorting for your RadGrid. You can find the below articles for more information on that matter:

    http://www.telerik.com/help/aspnet-ajax/grdapplycustomsortcriteria.html
    http://demos.telerik.com/aspnet-ajax/grid/examples/programming/sort/defaultcs.aspx

    Give it a try and let me know if any issues arise.

    Regards,
    Iana
    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
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. RD
    RD avatar
    12 posts
    Member since:
    Dec 2009

    Posted 19 Jul 2010 Link to this post

    I am also running into this issue where, by default, Oracle returns NULLs last when sorting...   However the RadGrid sorts NULLs to the top.  This causes a really ugly problem when combined with paging as the data looks incorrect.

    Changing the EnableLinqExpressions property doesn't help - what is needed is a way to tell the RadGrid to sort NULLs to the bottom - is there such a setting?
  5. Iana Tsolova
    Admin
    Iana Tsolova avatar
    3388 posts

    Posted 22 Jul 2010 Link to this post

    Hello RD,

    RadGrid does not provide such biult-in setting. What you can try is to implement custom sorting for your case.
    You can find more information on how to apply custom sort criteria for the grid here.

    Regards,
    Iana
    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
  6. Mani
    Mani avatar
    6 posts
    Member since:
    Nov 2013

    Posted 17 Dec 2013 Link to this post

    Hi,
    What if i dont want to sort it descending or acending but i want those to add them first in the grid...?

    When i add new record i wna it to be added to the first column but its adding in the last column in the last page. 
    How do i get it?

    Thanks.
  7. Pavlina
    Admin
    Pavlina avatar
    6084 posts

    Posted 20 Dec 2013 Link to this post

    Hi Mani,

    This is actually the default behavior of RadGrid control which is data-bound control and its items are created based on the records in its datasource. However you can use TableView's InsertItemPageIndexAction property to modify it to better match your requirements. For more information how to customize the insert form display position you can refer to the second grid from this online example .

    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.
  8. Abhijit Shetty
    Abhijit Shetty avatar
    36 posts
    Member since:
    May 2010

    Posted 29 Apr 2014 in reply to Iana Tsolova Link to this post

    Hi,
    The link you provide http://www.telerik.com/help/aspnet-ajax/grdapplycustomsortcriteria.html is broken. I have a situation to sort column having NULL value at bottom in both(ASC and DESC) order. How can i change sort expression for same?
  9. Pavlina
    Admin
    Pavlina avatar
    6084 posts

    Posted 30 Apr 2014 Link to this post

    Hi,

    Please excuse me for the broken link, here is the correct one:
    http://www.telerik.com/help/aspnet-ajax/grid-apply-custom-sort-criteria.html

    Regards,
    Pavlina
    Telerik
     

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

     
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017