
Hugues Ferland
Top achievements
Rank 1
Hugues Ferland
asked on 24 Nov 2011, 11:33 PM
Hello,
I was wondering why setting the AllowPaging property to true seems to cause a change is the grid's lifecycle.
Our grid uses the NeedDataSource event to get it's data and the EnableViewState is true. The documentation says that the a normal postback from a control outside of RadGrid should not trigger a NeedDataSource. This works when AllowPaging is set to false. But when we set AllowPaging to true the NeedDataSource event seems be behave as if the EnableViewState was set to false. Meaning that a postback from a control outside of RadGrid does trigger a NeedDataSource.
HF
I was wondering why setting the AllowPaging property to true seems to cause a change is the grid's lifecycle.
Our grid uses the NeedDataSource event to get it's data and the EnableViewState is true. The documentation says that the a normal postback from a control outside of RadGrid should not trigger a NeedDataSource. This works when AllowPaging is set to false. But when we set AllowPaging to true the NeedDataSource event seems be behave as if the EnableViewState was set to false. Meaning that a postback from a control outside of RadGrid does trigger a NeedDataSource.
HF
7 Answers, 1 is accepted
0

Shinu
Top achievements
Rank 2
answered on 25 Nov 2011, 05:10 AM
Hello Hugues,
Check the following help documentation which explains the event sequence in RadGrid.
Event sequence
-Shinu.
Check the following help documentation which explains the event sequence in RadGrid.
Event sequence
-Shinu.
0

Hugues Ferland
Top achievements
Rank 1
answered on 28 Nov 2011, 06:24 PM
Hi,
I am well aware of this documentation. But as I stated setting AllowPaging to true breaks the documented behavior. I have not found anything in the documentation that says that setting AllowPaging = true would have this effect.
This is a problem for us because it triggers an unneeded request to the database.
HF.
I am well aware of this documentation. But as I stated setting AllowPaging to true breaks the documented behavior. I have not found anything in the documentation that says that setting AllowPaging = true would have this effect.
This is a problem for us because it triggers an unneeded request to the database.
HF.
0

Shinu
Top achievements
Rank 2
answered on 29 Nov 2011, 05:55 AM
Hello Hugues,
RadGrid fires the NeedDataSource event each time it needs to be bound to a data source. This event fires whenever paging, sorting, operations occur.
-Shinu.
RadGrid fires the NeedDataSource event each time it needs to be bound to a data source. This event fires whenever paging, sorting, operations occur.
-Shinu.
0

Hugues Ferland
Top achievements
Rank 1
answered on 29 Nov 2011, 06:58 PM
I'm sorry. I think my post was not clear because this does not seem to address our issue.
I will illustrate it with a couple scenarios that explain better(I hope).
I will illustrate it with a couple scenarios that explain better(I hope).
Take a page with one grid(Grid1) and one button (Button1) in a different area of the page.
1.
2.
The documentation says the following.
The way I understand the documentation NeedDataSource should not fire in both scenarios. I found nothing that says that setting AllowPaging = true has the same result as setting EnableViewState = false.
The same thing happens if the grids were filtered or sorted before starting both scenarios. Maybe it's something we are doing wrong but it does not appear so from the tests we have done.
HF.
1.
- EnableViewState = true
- AllowPaging = false
- Click on Button1.
- Grid1 does NOT fire NeedDataSource (expected behavior)
2.
- EnableViewState = true
- AllowPaging = TRUE
- Click on Button 1.
- Grid1 fires NeedDataSource (unexpected behavior)
The documentation says the following.
The API and event sequence of RadGrid are quite similar to MS DataGrid/GridView. The sequence of the events is the following:
- RadGrid with EnableViewState set to true (default value)
Normal postback from a control outside of RadGrid: | |
For each Item in grid: | |
ItemCreated | |
Page.Load | |
Postback Events | |
Page.PreRender |
The way I understand the documentation NeedDataSource should not fire in both scenarios. I found nothing that says that setting AllowPaging = true has the same result as setting EnableViewState = false.
The same thing happens if the grids were filtered or sorted before starting both scenarios. Maybe it's something we are doing wrong but it does not appear so from the tests we have done.
0

Hugues Ferland
Top achievements
Rank 1
answered on 01 Dec 2011, 09:56 PM
bumb
0
Hi Hugues,
I tried to replicate the described issue with the latest version of RadControls but to no avail. I am attaching my test project to this message for your review. In it, NeedDataSource never fires on clicking the external button. Let me know if I am missing anything out.
Kind regards,
Tsvetina
the Telerik team
I tried to replicate the described issue with the latest version of RadControls but to no avail. I am attaching my test project to this message for your review. In it, NeedDataSource never fires on clicking the external button. Let me know if I am missing anything out.
Kind regards,
Tsvetina
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now
0

Hugues Ferland
Top achievements
Rank 1
answered on 02 Dec 2011, 10:11 PM
Thank you for the reply. Your project confirmed that the bug was somewhere on our side and knowing where not to look helped put us on the right track. We had a control visitor that under certain circumstances would reset the grids FilterExpression and then rebind the grid. Now we only have to figure out why it was there and who put it there.
HF
HF