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

Paging in radgrid without having the whole datasource and total rows count

6 Answers 732 Views
Grid
This is a migrated thread and some comments may be shown as answers.
tamil
Top achievements
Rank 1
tamil asked on 03 Feb 2012, 07:27 AM
Hi,
    I have a radgrid in default.aspx page. I want show some data in radgrid with paging. But I dont have the whole datasource at the Need_DataSource event. My backend is like, passing the pagecount and the service will return only 100 records of the Nth page. I dont know the approximate total rows count. How do I achieve paging in radgrid without having the whole datasource and total rows count?
Please guide me.


Thanks,
Tamil

6 Answers, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 03 Feb 2012, 07:43 AM
Hello,

One suggestion is you can use CustomPaging which allows you to fetch only a fixed number of records and perform operations on this limited set of data. Take a look at the following hep documentation which explains more about this.
Custom Paging.

-Shinu.
0
tamil
Top achievements
Rank 1
answered on 03 Feb 2012, 08:16 AM
Thanks for your reply. How to set the VirtualItemCount. I dont know the approximate total count of my whole datasource. Initially I will be having only a datasource with 100 rows. When clicking on the second page only, I can query the service to return the seconda 100 rows.
0
Maria Ilieva
Telerik team
answered on 07 Feb 2012, 02:03 PM
Hi,

You could still set a value for the VirtualItemCount.  If you set a value that is greater than the actual number of items, RadGrid will show all available items plus empty pages (or whatever other content you set) for the items that exceed the actual number.
For example you have a data source with 9'000 items and you set VirtualItemCount to 10'000. If your page size is 1000, the grid will render 10 pages and the last page will be empty (or with NoRecordsTemplate if you're using such).

All the best,
Maria Ilieva
the Telerik team
Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
0
tamil
Top achievements
Rank 1
answered on 07 Feb 2012, 02:13 PM
Thanks Maria for your reply. I dont know the items count initially, the count may be less than 100 or greater than 10,000. If I set the value randomly like VirtualItemCount = 10,000, will this affect the performance of the RadGrid?


Thanks,
Tamil
0
Shinu
Top achievements
Rank 2
answered on 08 Feb 2012, 06:16 AM
Hello.

Check the following help documentation which explains more about optimizing performance in RadGrid.
Client/server grid performance optimizations.

-Shinu.
0
Sean
Top achievements
Rank 1
answered on 07 Dec 2018, 07:57 PM

Hello,

Is there a way to get current DataSource? so i am setting whole list (its not data table or set its a DTO) as data source to grid. If when next page or any paging command is clicked and it needs data source i just want to take current one and give it back to the grid.

Thank you,

Sean

Tags
Grid
Asked by
tamil
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
tamil
Top achievements
Rank 1
Maria Ilieva
Telerik team
Sean
Top achievements
Rank 1
Share this question
or