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

RadGrid - Bind only visible data and write the sort logic on the binding

2 Answers 117 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Martin
Top achievements
Rank 1
Martin asked on 26 Jun 2014, 09:16 PM
Good evening,

I'm working with the ASP.NET GridView as well as the Telerik RadGrid and I'm missing a behavior on your Grid that was kinda typically on the classic Grid of MS.

Let's say I'm displaying 100 items per page of 1000 items total, paging is on and I am on page 3. On the MS grid I'm able to limit the bound data to the data I just want to display, and I still can trick the Grid to believe there are more items than actually bound by setting VirtualItemCount to 1000 to still get my 10 pages on the navigation instead of just one. So I only have to load 100 sets of data from the database for every postback. When sorting the data, I can simply order the data before skipping and taking and finally binding to my data, such as on the entity framework.
this.grid.DataSource = context.TABLE.OrderBy(x => x.Name).Skip(this.grid.PageIndex * this.grid.PageSize).Take(this.grid.PageSize).ToList();

Your grid is awesome, because it tries to do the order-job for me. But this only works if I give your grid the full 1000 items on the data source, I dislike. 
But first, I tried to simply display 100 items and set VirtualItemCount to 1000. The page navigation was not shown, assuming it was only 1 page for it.

Can you provide me any way to tell your grid to act like there are 1000 items on it, while only 100 items are bound? When this would work, I know the grid cannot sort all my datasets when the user presses on a column of course, because the grid has not all the data. Can I implement the manual sorting to your grid on similar ways like on the ASP.NET GridView?

An minimal example just with the features I'm looking for would be great.


Thanks in advice.

2 Answers, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 27 Jun 2014, 04:41 AM
Hi Martin,

You can take a look at the Custom Paging functionality of RadGrid to fetch only a fixed number of records and perform operations on this limited set of data.
Custom Paging

Thanks,
Princy
0
Martin
Top achievements
Rank 1
answered on 27 Jun 2014, 09:01 AM
Oh how embarrassing, just forgot the AllowCustomPaging, ouch.

Thank you.
Tags
Grid
Asked by
Martin
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Martin
Top achievements
Rank 1
Share this question
or