I was hoping FlyTreeView might make it easier to get around this one, but not yet...
I have a page with a treeview on the left side, which gets populated in code with several different types of item from a database. There can be up to 6 levels in the treeview. The idea is that when the user selects an item in the tree by clicking it, details of that item appear in a DetailsView on the right. They can edit item details, and also add new items or delete them (at leaf level). All fine so far.
But there is one scenario that is causing the problem - one type of item can be edited in a way that causes it to move to a different part of the tree, so effectively the structure of the treeview changes, not at leaf level. The edit happens and the treeview gets repopulated and redisplayed correctly, but the next time an item is selected - boom, the "Failed to load viewstate" exception ( I have PostBackOnSelect set true for most nodes). I thought maybe I could set EnableViewState=false, but if I do that I don't even get the NodeSelected events fired. I can sort of understand what is happening here, but can't see a way around it. I need to be able to support this function in the system, i.e. I need to get the edited details on a postback, and I need to be able to repopulate the tree in the new structure. Is this possible? If so, how do I need to go about it? This is making my brain hurt!