RadGridView Server Side Filtering - Silverlight

1 posts, 0 answers
  1. spam
    spam avatar
    10 posts
    Member since:
    Dec 2010

    Posted 30 Jul 2012 Link to this post

    I have the following code that retrieves 50 records at a time each time I page.

          string SortFilter = _view == null ? string.Empty : AvailableGridSortFilter;
                    AvailableAdSizeQuery = (context.vwBusinessUnitAdSizes
                       .AddQueryOption("$filter", "(Active eq true) and (not (substringof('" + BuAbbr + "',BusinessUnits)) or (BusinessUnits eq null))")   
                       .AddQueryOption("$orderby", HttpUtility.UrlEncode(SortFilter)).Skip(pageIndex * 50).Take(50)
                       as DataServiceQuery<vwBusinessUnitAdSize>).IncludeTotalCount();


    This code allows me to sort all my records based on the amount of records met by the criteria in the db and not just the 50 records retrieved.

    For example, let's say I had 100 records & one of the columns is COUNTRY. 60 records has France & 40 had Italy. Let's, before any sorting is done, for the 50 records 20 displayed France & 30 Italy. Before I added this code, if I sorted the country column, it showed the first 20 records with France and then the 30 with Italy. What i want it to do and what this code accomplished is showing the first 50 as France and the next page would have 10 more for France and the remaining would be Italy.

    I say all this b/c I want my filtering to work the same. Currently, it filter only on the first 50 records.  What do I need to do make sure my filtering isn't limited to the 50 records retrieved? That is, if I sort by country & the first 50 show only France, I would still like the filter to show Italy.

    Hope that makes sense.

    Thanks in advance for your time.


Back to Top