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

[Solved] How to set the Pager page count, or ...

1 Answer 165 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Taburetka Kekc
Top achievements
Rank 1
Taburetka Kekc asked on 28 Sep 2009, 10:59 AM
Hello everybody !

i've got a RadGrid with paging enabled and 1600+ rows.
and i wanted to optimize it's performance by querying data only for items which are currently shown, so i made NeedDatasource event  look like this :

        protected void RadGrid1_NeedDataSource(object source, Telerik.Web.UI.GridNeedDataSourceEventArgs e)
        {
            int currentPageIndex = RadGrid1.MasterTableView.CurrentPageIndex;
            int itemsToTake = RadGrid1.PageSize;
            int offset = currentPageIndex * itemsToTake;
            var ds = GetGridDataSource(itemsToTake, offset);
            RadGrid1.DataSource = ds;
        }
it worked, but the pager now dissapeared, i tryed to set VirtualItemCount property to 1600, but nothing happened.

are there any possibility to set Pager pages count ? or maybe there exists better solution to optimize performance ?

Thank You !

1 Answer, 1 is accepted

Sort by
0
Accepted
Pavlina
Telerik team
answered on 28 Sep 2009, 11:30 AM
Hi,

To optimize the control performance on the client as much as possible, you may use built-in/custom paging and present only fixed set of records at a time - here are online examples for it:
http://demos.telerik.com/aspnet-ajax/grid/examples/generalfeatures/paging/defaultcs.aspx
http://demos.telerik.com/aspnet-ajax/grid/examples/programming/custompaging/defaultcs.aspx

In case you have more than 100 records in a flat grid, it is recommended to turn on the build-in paging/custom paging of the grid. This will not only optimize the grid loading time but also will enrich the user experience, thus giving him/her the flexibility to easily navigate through the grid records.

Greetings,
Pavlina
the Telerik team

 


Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Tags
Grid
Asked by
Taburetka Kekc
Top achievements
Rank 1
Answers by
Pavlina
Telerik team
Share this question
or