radgrid and custompaging using linqdatasource

4 posts, 0 answers
  1. Raj
    Raj avatar
    1 posts
    Member since:
    Jun 2012

    Posted 25 Jun 2012 Link to this post

    HI, in your demos you have needdatasource and objectdatasource version of custom paging.  I need to use LinqDatasource and implement custom paging.  I have been trying it but with no lock.  can you pl advice.  thx
  2. Radoslav
    Radoslav avatar
    1564 posts

    Posted 28 Jun 2012 Link to this post

    Hi Raj,

    To achieve the desired functionality you could try using the following code snippet:
    protected void linqDS_Selecting(object sender, LinqDataSourceSelectEventArgs e)
        // LINQ query
        var query = from c in myDC.Class
                    select c;
        // Set the total count    
        e.Arguments.TotalRowCount = query.Count();
        // Get only the rows we need for the page requested
        query = query.Skip(RadGrid1.CurrentPageIndex * PAGE_SIZE).Take(PAGE_SIZE);
        e.Result = query;

    I hope this helps.

    the Telerik team
    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 their blog feed now.
  3. DevCraft R3 2016 release webinar banner
  4. John
    John avatar
    43 posts
    Member since:
    Aug 2014

    Posted 09 Oct 2015 in reply to Radoslav Link to this post

    ISome detailed explanation for ...

    // LINQ query
        var query = from c in myDC.Class
                    select c; 


    ... would be much appreciated.  Thanks.

  5. Radoslav
    Radoslav avatar
    1564 posts

    Posted 14 Oct 2015 Link to this post

    Hello John,

    This is a standard linq to sql select query where myDC is the context and the Class is the entity. More information you can find here:

    I hope this helps.

    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 Feedback Portal and vote to affect the priority of the items
Back to Top