Ticket Q208774
Visible to All Users

Saving values in Viewstate

created 16 years ago

I am trying to save my data that populates the TreeList in a ViewState. When nodes are editted, I want to update their values in the ViewState. But no changes seem to be saved in the ViewState. The Page.SaveViewState method is not even called after an edit or after a tree is expanded (it is only called on first page load).
Why can't I update the Page ViewState from one of the AJAX callbacks from a TreeList? Do I need to do something to allow the ViewState to be changed during postbacks from the TreeList?
Thanks!

Show previous comments (7)

    Yes, I would like to use the ViewState to serialize my datasource. But the problem is that the ViewState is not saved during postbacks such as when I edit or delete a row. Is there a way to "tell" the ASPxTreeList to allow the ViewState to be saved? Otherwise, I do not see how the ViewState can be used.
    Thanks.

      … the reason I cannot just save the data to the database on each postback (ajax call), is that I need to put a cancel on the page to cancel all pending updates. The data should only be saved back to the database when the OK button is hit. If the user cancels, or does not hit "ok", none of their edits should be saved.

      DevExpress Support Team 16 years ago

        Hi Jay,

        The ViewState is stored in a hidden field which is rendered in the page's header. During a callback, the client receives the content of the control which initiated this callback. ViewState is not sent to the client (since it sits in the header) and our controls cannot embed it in the response and then update the corresponding hidden field. A possible solution is to set the ASPxTreeList's EnableCallbacks property value to false, and use the ASPxTreeList on the MS UpdatePanel. It will be able to intercept a TreeList's postbacks and "convert" them to callbacks. It is also able to update the ViewState.
        Thanks,
        Plato

        Disclaimer: The information provided on DevExpress.com and affiliated web properties (including the DevExpress Support Center) is provided "as is" without warranty of any kind. Developer Express Inc disclaims all warranties, either express or implied, including the warranties of merchantability and fitness for a particular purpose. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.

        Confidential Information: Developer Express Inc does not wish to receive, will not act to procure, nor will it solicit, confidential or proprietary materials and information from you through the DevExpress Support Center or its web properties. Any and all materials or information divulged during chats, email communications, online discussions, Support Center tickets, or made available to Developer Express Inc in any manner will be deemed NOT to be confidential by Developer Express Inc. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.