Greetings,
I have a curious situation where I'm trying to use values stored in cookies. The value I'm storing is a value from a dropdownbox that controls the PageSize of a DataGrid. The AutoPostBack feature of the dropdownbox is turned on. When a new value from the dropdownbox is changed, the cookie value is written. The writing part of this process works as expected.
Included in the SelectChange function, after writing the cookie value, I rebind the page. In this rebinding, I would expect the new cookie value to be available, but it doesn't appear to be. Instead, the old value of the cookie is used, and the postback has no change in PageSize.
The only way I've been able to get this to work is to store the PageSize in two places. When the PageSize changes, I write it to the view_state and a cookie. Across postbacks, I then use the view_state value, always updating the cookie value if it changes. Then, when the page loads for the first time on subsequent visits, I use the cookie value since the view_state is obviously uninitialized.
This seems awkward... it works, but I'm hoping there's something to explain why the cookie value isn't immediately available. Perhaps it will never be? I guess it kind of makes sense that you wouldn't be able to read updates to a changed cookie in the same post.