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

Custom paging with RadGridView, RadDataPager a WCF Service

5 Answers 229 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Vojtech Prehnal
Top achievements
Rank 1
Vojtech Prehnal asked on 31 Mar 2010, 09:26 AM
I try to perform custom paging via WCF service. I have RadDataPager connected to RadGridView. I want to pass actual PageIndex and PageSize to my WCF service and this service should return only rows for actual page. But I need to be able to list through all the pages using RadDataPager, so I need to set the number of pages or rows in the grid.

Is something like VirtualItemCount (in ASP.NET components) available for Silverlight components too? Or is it possible to set number of pages in RadDataPager programatically?

5 Answers, 1 is accepted

Sort by
0
Vlad
Telerik team
answered on 31 Mar 2010, 09:43 AM
Hi ,

Please check this blog post to know more how to achieve this. The same approach can be used with RadDataPager and standard DataPager.

Regards,
Vlad
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.
0
Vojtech Prehnal
Top achievements
Rank 1
answered on 31 Mar 2010, 11:22 AM
Hi Vlad, thanks for prompt reply. Is it possible to perform server-side paging/filtering/grouping without RIA / LINQ? I'd like to perform paging in WCF service manually using own SQL-code.

I have my OrdersService like this:
public class OrdersService  
{  
    [OperationContract]  
    public List<Order> ReadOrders(int PageIndex, int PageSize)  
    {  
        // ... query with custom paging using T-SQL's ROW_NUMBER  
    }  
 
    [OperationContract]  
    public int NumOrders()  
    {  
        // ... pseudocode: return (SELECT COUNT(OrderID) FROM Orders)  
    }  
}
 

I need to call OrdersServiceReference.ReadOrdersAsync(radDataPager.PageIndex, radDataPager.PageSize) and this service should return only <PageSize> rows (e.g. 10). But I want my RadGridPager to show that there is e.g. 7200 pages in database, so I would need something like:
OrdersServiceReference.NumOrdersAsync();  
 
...  
 
ordersServiceClient_NumOrdersCompleted(e)  
{  
    radDataPager.PageCount = Convert.ToInt32(e.Result) / radDataPager.PageSize;  
    // or:  
    radGridView.VirtualItemCount = Convert.ToInt32(e.Result);  
}  
 
 
0
Vlad
Telerik team
answered on 31 Mar 2010, 11:33 AM
Vojtech,

My blog post (posted in my previous reply) is exactly this - you can check the post title for more info!

Kind regards,
Vlad
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.
0
yjh
Top achievements
Rank 1
answered on 21 May 2010, 04:25 PM
I download the source code from your blog and try it.

The demo run correctly first,but when reference the last build of RadControls for silverlight, it always keep pageindex to 0 and can't jump to other page even you click numeric button of RadDataPager or  DataPager.
0
Vlad
Telerik team
answered on 25 May 2010, 08:29 AM
Hi,

Please check the project attached in your other forum thread.

Regards,
Vlad
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.
Tags
GridView
Asked by
Vojtech Prehnal
Top achievements
Rank 1
Answers by
Vlad
Telerik team
Vojtech Prehnal
Top achievements
Rank 1
yjh
Top achievements
Rank 1
Share this question
or