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

[Solved] Is this a bug or am I confused!!!

3 Answers 87 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Carl
Top achievements
Rank 1
Carl asked on 22 Oct 2009, 08:47 PM
I am using the grid to dispaly different photo albums. When the ComboBox album selector changes and with ViewState of the Grid enabled, the handler for the OnSelectedIndexChanged event for the ComboBox calls the Rebind() method of the grid to force the grid to rebind which eventually results in the OnNeedDataSource being called to allow the data source for the grid to be updated.

It appears that the Grid.CurrentPageIndex is not being reset to zero when the Grid is rebound. So if this index was anything other than 0 when the Rebind() method was called, an attempt to load the grid with the page index of the previous state of the grid will result.

Since ViewState is enabled, an argument could be made that the CurrentPageIndex is just being persisted due to the persistence resulting from ViewState. But is there really ever a valid case where the paging index should be anything other than 0 after the Grid is rebound.

To me new data implies a new state with indexes reset to zero. If for some reason someone wants an index other than zero when the grid rebinds, then it would seem to be up to them to set the index to whatever they wanted.

I have a feeling that this is not going to go my way.  No big deal, this is a very, very good product.

3 Answers, 1 is accepted

Sort by
0
Schlurk
Top achievements
Rank 2
answered on 23 Oct 2009, 09:43 PM
You could always try this piece of code after the Rebind() method has been called:

 
RadGrid1.CurrentPageIndex = 0; 

0
Carl
Top achievements
Rank 1
answered on 24 Oct 2009, 01:30 AM
Before I made the post, I had already fixed the problem by setting CurrentPageIndex = 0.

But this is really not the point. I am bringing this up because I am wondering if this is either a bug or oversight in the design of this control.

To me it makes no sense for the Current Page Index to not be reset when the grid is bound with totally new data.

But having said this, I continue to be very impressed by the quality of this product.

Go Telerik!!!

0
Sebastian
Telerik team
answered on 26 Oct 2009, 10:44 AM
Hello Carl,

Indeed you need to reset the current page index manually when binding the grid to a new set of data since the control cannot determine that action internally. We consider that as a necessary step rather than a bug in the control itself.

Best regards,
Sebastian
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
Carl
Top achievements
Rank 1
Answers by
Schlurk
Top achievements
Rank 2
Carl
Top achievements
Rank 1
Sebastian
Telerik team
Share this question
or