I am using pager Mode="NextPrevNumericAndAdvanced" with PageSize
enter 10 in change page size textbox and click on Change, OK data is visible
Click on Change again without doing anything else.
result: grid is empty.
What is noticed:
PageSizeChanged event does not fire on 2nd attempt.
Note: This behavior observed only for value 10.
10 Answers, 1 is accepted
I believe binding technique used is ok, just worried about why the PageSizeChanged event does not fire on 2nd attempt just for 10 and it fires for any other value..
PageSize ="10" changed to PageSize ="15" but has no effect.
It was my mistake, now it is working fine.
There was a script error in grid's itemcreated event.
I cant get PageSizeChanged to work properly at all:
bug# 1: if PageSize value set in the skin - event fires on every postback (even after sorting)
bug #2: doesnt matter what value user enter in the PageSizeTextBox control: in the PageSizeChange event handler in the event arguments I ALWAYS recieve the value, which is set in the .ASCX file or in the skin file (i.e. set in design time).
bug#3: I've tried to set CORRECT value: Grid.PageSize = 10 (for example) (I use default value of 100 rows). NO EFFECT. Value changes and then reverts back to 100 somewhere: in the Selecting event of my ObjectDataSource (which executes directly after that PageSizeChanged event) I can see already default value 100 is back.
bug#4: please explain, why ObjectDataSource run DB query twice on every postback and only once on regular page load ? I dont use advanced databinding. I'm using declarative ObjectDataSource & declarative binding of it in the grid. The problem is with sorting: when user click on some column to sort, my ObjectDataSource runs 2 queries instead of ONE: with old sort values and with new one. What is your proposed workaround to this issue ?
Can you please check whether the issues you encountered are address in the latest Q2 2008 version of RadControls for ASP.NET AJAX (2008.1.723)? It seems that you are using an outdated version of our components and the problems you encountered should be addressed.
the Telerik team
Check out Telerik Trainer, the state of the art learning tool for Telerik products.
tested latest version (2008.2.723.20) and here are results:
bug#1 - fixed
bug#2 - fixed
bug#3 - not fixed. I mean changing PageSize value from C# code dont work
I need this feature ! See below (bug #5)
bug #4 - not fixed
Databinding occures twice: with old sort expression and with a new one.
What is your recommended solution, to NOT hit database with old sort expression query, only with a new one. I assume, we need to use some kind of flags - on the PostBack run DB query only after some RadGrid events - like after Sorting, PageIndex changing etc.
bug #5 - amazing feature ? I open a page with a RadGrid and can see 10 rows per page and many many pages available. I change PageSize to 100 rows per page. Now I have 2 available pages. I enter page #2 into the GoToPageTextBox - and after page refresh, I see AGAIN 10 ROWS PER PAGE ! Why you reset that value ? I just want to see rows starting from 2nd page with a page size of 100 ! i.e. I want to see rows 101 - 199 ! And RadGrid shows me rows 11-19 (2nd page but PageSize reset back to default value of 10).
What is your recommended workaround for this "feature" ?
looks like you are using VIEWSTATE to keep PageSize !
I've tried this:
1) disable viewstate -> setting PageSize in the TextBox on the Grid changes page size (but it will be reset after any other postback, like sorting or page changing, which is NOT EXPECTED behavior !). BUT at the same time I cant change PageSize property programmatically from: PageSizeChanged event, PageLoad event.
2) enable viewstate -> setting PageSize in the same TextBox DOES NO EFFECT. BUT I can now set it programmatically to any value I need ;-)
You are kidding, right ? ;-) Its such a joke ? Only one way at a time: user-setting or code-setting ?
Here they are:
2) User-defined page-size should work and should NOT reset after sorting or page changing.
3) PageSizeChanged event should fire ONCE and ONLY when postback caused by PageSizeTextBox or its corresponding button. I dont need that event to fire when page is loading 1st time and property assigned with defaul value from the .skin file.
I need this behavior to implement saving user-preferred page size not only across page postbacks but also during the session or longer.
I'm using declarative binding and I have like 50+ user controls with RadGrids on them. So, correct skins support is a MUST also.
4) PageSizeChanged event handler should recieve CORRECT value in the GridPageSizeChangedEventArgs. It means, if user entered 50, and default was 100, I need value of 50 in this event handler.
Having EnableViewState="true" is possible but I'd like to keep it OFF to reduce page size.
I've found, your component dont generate events correctly when viewstate is OFF and dont pass correct pagesize value when viewstate is ON. This makes this feature totally un-usable !
ViewState is required for all grid automatic operations. If you want to get rid off the ViewState string you can use SessionPageStatePersister.
Other possible solution is to use client-side data-binding or the approach from this example: