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

Page and row count not in sync after changing datasource

4 Answers 160 Views
Grid
This is a migrated thread and some comments may be shown as answers.
christopher willis
Top achievements
Rank 1
christopher willis asked on 30 Apr 2008, 04:20 PM

I'm using a dynamically added grid, and handing the grid a dataset during the NeedDataSource event.  The contents of that dataset can change based on some other controls I have for filtering.

Grouping and paging and ajax are enabled, and all seem to work fine.  The problem is the footer at the bottom always says the original row and page count.  So if I hand the grid a 16 row dataset in NeedDataSource, and then in the next call a 1 row dataset, the footer still says displaying page "Displaying page 1 of 2, items 1 to 15 of 16."

Turning gird viewstate on and off did not help, nor did setting the grid datasource to Null and doing a Rebind(). 

Is there some way to force the footer to refresh?

4 Answers, 1 is accepted

Sort by
0
Konstantin Petkov
Telerik team
answered on 01 May 2008, 10:06 AM
Hello Christopher,

This sounds like a bug since the Grid should update its footer automatically, especially when you set its DataSource through the NeedDataSource event.

Do you work in .Net 3.5? If so, could you check if the Grid's EnableLinqExpressions set to false fix the problem?

Sincerely yours,
Konstantin Petkov
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
christopher willis
Top achievements
Rank 1
answered on 01 May 2008, 04:10 PM
Cool, that did fix it.  Thank you.
0
Mike Nogen
Top achievements
Rank 1
answered on 18 Nov 2009, 03:45 PM
I have a similar problem. Using a dynamically created grid binding it in the NeedDataSource event. Everthing is working great except one thing. In the RadGrid1_ItemDataBound I check some things to see if a specific row should be displayed or not. If I here put a DataItem to

item.Display = false;  
item.Visible = false

It dosen´t show in the Grid but in the footer it still says that there are 50 rows even I have putted two rows into Visible false mode. How can I get the total number of items in the footer to reflect the current state? Problem number two is that If I use paging and with a size for example 5. If I on page one disable one row from displaying the number of items in the first page will be four. It seems that the grid dosen´t render after RadGrid1_ItemDataBound. Is that correct?
0
Martin
Telerik team
answered on 23 Nov 2009, 02:57 PM
Hello Mike,

The RadGrid build-in pager shows the item count received from the datasource. So setting the "visible" or "display" properties of a particular item will not affect the item count that the pager displays. In order to "exclude" an item from the count  you should ensure to exclude it from the  datasource before the grid is bound to it.

Another option is to use a pager template where you can customize your pager count. You can review the following online demo example for more information:

Pager template

I hope this helps,
Martin
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
christopher willis
Top achievements
Rank 1
Answers by
Konstantin Petkov
Telerik team
christopher willis
Top achievements
Rank 1
Mike Nogen
Top achievements
Rank 1
Martin
Telerik team
Share this question
or