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

radgrid and custompaging using linqdatasource

3 Answers 41 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Raj
Top achievements
Rank 1
Raj asked on 26 Jun 2012, 12:11 AM
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

3 Answers, 1 is accepted

Sort by
0
Radoslav
Telerik team
answered on 28 Jun 2012, 08:22 AM
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.

Regards,
Radoslav
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.
0
John
Top achievements
Rank 1
answered on 09 Oct 2015, 08:10 PM

ISome detailed explanation for ...

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

 

... would be much appreciated.  Thanks.

0
Radoslav
Telerik team
answered on 14 Oct 2015, 07:36 AM
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:
https://msdn.microsoft.com/en-us/library/bb308959.aspx
https://msdn.microsoft.com/en-us/library/bb425822.aspx
https://msdn.microsoft.com/en-us/library/bb397947.aspx

I hope this helps.

Regards,
Radoslav
Telerik
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
Tags
Grid
Asked by
Raj
Top achievements
Rank 1
Answers by
Radoslav
Telerik team
John
Top achievements
Rank 1
Share this question
or