I have a webcombo that retrieves it's data on demand. That is I never have the full data set in memory, only the current page. Everything works fine until a page post back occurs.
Here is the scenario that breaks. I load the control and select the second page. I then select an item from the second page.
When I get a page postback for the selected item changed event, the data bind event happens, but my current page is always set to page one, so I bind to page 1, then the selected index event fires and my current page is updated to the correct current page, however the event args have the row from the first page. Finally, I get a page change event fired. It seems to me that the page change events that are fired via XmlHttp are not properly passed down on post back, causing me to bind to the wrong set of data. Is there anyway to work around this?
I have tried storing the current page in ViewState, but it appears Viewstate is not getting written back during the XmlHttp postbacks. Has anyone else seen this behavior? Is there a way to make this work?
-Daniel
I was able to get my code working although I still don't think things are working like they should. My problem ended up being that I did not call DataBind() after setting my datasource.
However, because the Current page is not correct I still end up binding to the wrong data set on the initial post back and have to fix it up during the selected index changed event. The event is always called with the event data as null (for selected row and column), but luckily the index is correct so that I can get the correct item.
It seems to me that the current page should be passed back during the page postback and set correctly during the initialize data source event. Then I could bind correctly.
If someone knows what I am missing and how this could be made better I would appreciate the help.