Persistence of configuration after postback

2 posts, 0 answers
  1. Paul Robertson
    Paul Robertson avatar
    78 posts
    Member since:
    May 2010

    Posted 05 May 2012 Link to this post

    Dear all

    I wonder if somebody could help clarify something about the persistence behaviour I should be expecting from the RadTreeView's EnableViewState property? I am not sure if I am seeing the behaviour by design or not ...

    I have a RadTreeView control which does not appear to maintain its node display arrangement after a postback, in that if the user expands a node, after postback the node has been collapsed once more. Also, when it comes to the underlying datasource bindings etc of the RadTreeView control, it seems as though the control does not persist the Datasource property, for example, that is configured when the control first loads on the initial post of the page. For example, the RadTreeView in question binds to a hierarchical datasource object, but I am having to reconfigure the RadTreeView to a datasource object after each postback, which seems a little counter-intuitive, and a bit of an inefficiency that I would expect the RadTreeView control to avoid by maintaining the state of the datasource object. Perhaps the data configuration and hierarchy display changes would need to be made manually with a Session object instead?

    However, I would be interested to know if this is the correct way to go about this issue, or whether I am missing something of importance. 

    Thanks very much for any advise!


  2. Plamen
    Plamen avatar
    3049 posts

    Posted 10 May 2012 Link to this post

    Hi Poul,

    The expand state of the nodes is kept in the client state of RadTreeView and does not depend on the EnableViewState property. In ViewState are kept some other properties that serve the overall behavior of the control. If you want to keep the expand state of nodes after postback you can refer to this Code Library.

     As for the binding to hierarchical datasource please refer to this help topic where a explained how to use it.

    Hope this information will be helpful.

    Plamen Zdravkov
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
Back to Top