More in this section

Forums / Bugs & Issues / sf 4.1 sp1 using orderby in where clause no longer works

sf 4.1 sp1 using orderby in where clause no longer works

2 posts, 0 answered
  1. Brandon
    Brandon avatar
    50 posts
    Registered:
    30 Jul 2009
    17 May 2011
    Link to this post
    so we upgraded to 4.1 sp1 and it broke some of our custom widgets. these widgets allow an editor to choose a category or multiple categories and then display the content from that category in the radrotator and a video list widget. (these are 2 different ones but work similarly)

    anyways we were using

    foreach (NewsItem item in items.Where(n => n.Status == ContentLifecycleStatus.Live).OrderByDescending(n => n.DateCreated))

    but that did not throw any exceptions nor did it display any data. after removing the orderby guess what...it worked fine. i also want to point out this exact same code worked perfectly fine prior to the sp1 update. our last version was 4.1.1367 internal build.

    the new code to make our widgets work again after what i consider a bug is the below.

    foreach (NewsItem item in items.Where(n => n.Status == ContentLifecycleStatus.Live).Reverse())

    Please check your sorting using orderby...I dont see why this doesn't work in the sp1 -
    4.1.1395.0 PE
  2. Boyan Barnev
    Boyan Barnev avatar
    1429 posts
    Registered:
    28 Aug 2017
    19 May 2011
    Link to this post
    Hi Brandon,

    Thank you for using our services. Can you, please take a look at the provided sample I've just tested, and OrderByDescending was working fine when providing a RadGrid with the results.
    var fluent = App.WorkWith();
                var newsItems = fluent.NewsItems()
                    .Where(ni => ni.Status == Telerik.Sitefinity.GenericContent.Model.ContentLifecycleStatus.Live).Get().ToList()
                    .OrderByDescending(ni => ni.PublicationDate);
                Grid1.DataSource = newsItems;
                Grid1.DataBind();

    Can you, please share with us some more details on your custom widget implementation, maybe the behavior you are describing is related to it?


    All the best,
    Boyan Barnev
    the Telerik team
    Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
2 posts, 0 answered