I have been playing with ListView and DataPager a lot lately. One reason is I have read a quite lot on these controls and thought very high of it. The combination gives us a light weight data control with Pagination facility. What more can you ask for, right?
To a vanilla page (with no gimmicks), these controls behave very nice. But once, you start your circus, they don't bend.
The magic of pagination lies in PageDataPropertiesChange() event of the ListView control. This is the event where you set the next page number properties to retrieve the next set of data. Whenever you click on a page number (which is rendered by the DataPager control), the PageDataPropertiesChange() event gets triggered.
One scenario I had was with a ListView control, the controls of which I wanted to change dynamically, particularly on ItemDataBound event. But, every time any control changes in ListView Item, the PageDataPropertiesChange() gets hit! So, pagination happens even before I hit the page numbers in the DataPager control. And that was my problem, and which it took some time to figure it out. Particularly after a heavy dose of Indian Bread and Tuna curry! :)
So there was no way out. I needed the dynamic behaviour of ListView and the pagination wouldn't budge.
After lot of googling around, I had to succumb. I split up the pages, which I am not still happy about.
The one thing I don't understand, why would a ListView event get hit when the DataPager control is shaken?
If you know of any tricks, please pass me on.