I'm having a stateful issue on an ASP.NET AJAX page. Short version. I need to somehow refresh the ViewState page after the async callback has been executed to reflect any change in the state of the server created during the asynchronous call.
This seems to be a common problem, but I will describe my scenario to help explain:
I have a grid-like control that has some JavaScript enhancements, namely the ability to drag columns and rows. When a column or row is deleted to a new position, the AJAX method is called to notify the server part of the control and fire the corresponding server event ("OnColumnMoved" or "OnRowMoved").
ASP.NET AJAX causes the entire page to be sent as a request by default. Thus, the page goes through the full life cycle, the viewstate is saved, and the state of the control is restored before the RaiseCallbackEvent method is called.
However, since the AJAX call does not refresh the page, the ViewState reflects the original state of the control even after moving a column or row. Thus, the second time the client-side action occurs, the AJAX request is sent to the server, and the page and control are created again to reflect the first state of the control, and not the state after moving the first column or row.
This problem has many consequences. For example, if we have an action on the client side / AJAX to add a new element to the grid, and then the line is dragged, the grid is created on the server side with one fewer elements than on the client side.
And finally, and most seriously for my specific example, the actual data source object we are working on is stored on the ViewState page. This was a constructive solution that allows you to save a copy with saved states of managed data that can be transferred to the database after many manipulations or discarded if the user backs down. It is very difficult to change.
So, again, I need the ViewState page to be refreshed in the callback after the AJAX method is run.
Rex m
source share