Is there an option that can be set to persist the expanded nodes during postback? My tree is set to load-on-demand with only the 1st level nodes being initially loaded. If the user expands several nodes and a postback occurs I want to be able to keep the grid in the same state after postback.
Hello Bob,
I have created a small sample with the behavior you are describing. I have a WebDataTree that binds to a XmlDataSource and a WebImageButton. The WebImageButton does a post back on click. When I run it I expand a few nodes and the click the WebImageButton to do a post back, the page refreshes and the WebDataTree remains in the state it was before the post back. If this is not the case in the project you are working on please check to see that EnableViewState and EnableAjaxViewState are set to true.
Please let me know if I may be of further assistance with this issue.
Sincerely,
Mike P.
Developer Support Engineer
Infragistics, Inc.
www.infragistics.com
I added EnableViewState and EnableAjaxViewState = true and it still doesn't work. On my page I have a button that posts back and gets a dataset (3 tables) , saves it to session variable and sets the datasource of the tree to the session variable and does a databind.. In Page_Load I set the datasource of the tree back to the session variable.
If I don't have the datasource set on page_load then none of the nodes ever get data when they try to expand.
I am following up to see if the sample I provided in my last update resolved your issue.
Please let me know if I may be of further assistance with this matter.
I have not tested the exact code you sent, but that is essentially what I ended up doing although I used the webDataTree.DataBound event to re-select and re-expand the necessary nodes. Is there any drawback to using that event or would page load complete be more appropriate?
If using the DataBound event is current working I do not see and issue with using that event. I did the persisting of the state of the WebDataTree in the the Page_Load because it allowed me to temporarily save out the information I needed and set it back after the DataBind happened which is where the tree expanded state would reset.
I am following up to see if I may be of further assistance with this matter.
I haven't heard from you in a few days and just wanted to check to see if there was anything else I can do for you. If I don't hear from you in 3 days I will go ahead and close this case as inactive. Once a case is closed you will still be able to open it again within 30 days.