Hi,
I am populating ~1500 nodes in a tree based on a web service call that takes about 10 sec to return (no control over that). I do this on Page_Load.
protected void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack)
{
LoadTree();
}
//other code to handle when user selects item and other postbacks
}
When i click on node to expand or collapse the entire tree disappears! I have to call LoadTree() on every Page_Load? I cannot deliver a web site that takes 10s to reload page everytime you expand a node in tree (esp. ironic since all the data is there already).
In postback I plan to load supplemental data based on users choice (another time consuming process) - tree disappears then too unless I reload!
Can I get node expand/contract to work exclusively on the client? Ideally I can get notification of node selected and use AJAX update to refresh supplemental data w/o disturbing the treelist.
I see disturbing posts that indicate my 1500 nodes of data are somehow discarded on postback - what is the workaround for that? I don't want to invent workaround for server side storage of data - can I serialize treelist to viewstate or hidden field (something I thought was automatic already) and reload from there if I have to?
Am I missing something? The documentation / samples are pretty sparse and seem to focus on loading a tree from a static XML file or an instant query of a few records from local Access database - not something I ever expect to see in real life.
Hi
This behavior is by design. The ASPxTreeList does not persist its nodes in the ViewState. You should create nodes on every page load.
I recommend that you use some caching mechanism. For instance, you can cache data in the Session state on the server, and update it all in every 10 minutes.