Monday, March 26, 2012

UpdatePanel .Net Treeview.PopulateOnDemand conflict?

I am having a problem where the first use of an update panel on my page seems to deactivate the Treeview.PopulateOnDemand event.

I have a .Net 2.0 treeview set up to browse hierachical data. It implements PopulateOnDemand to avoid having to display all the data at once. The EnablePartialRendering property of the ScriptManager is set to true.

I also have an update panel on the page that populates a datagrid when the user selects a treenode.

PopulateOnDemand works fine until theSelectedNodeChangedevent triggers the refresh of the update panel. Then PopulateOnDemand doesn't work anymore.

The application works properly if I set the EnablePartialRendering property to false, but then of course I get a visible postback, which I don't want.

I have read that the .Net 2.0 treeview implements some version of Atlas, and it may be the case that this is the source of the conflict between the treeview and the update panel.

Has anyone encountered a similar problem? Can anyone suggest a workaround?

And an update:

I downloaded Nikhil Kothari's Web Development Helper (what an amazing tool) and found a 500 error when I tried to repopulate nodes after using the update panel -- this explains why the node won't populate.

To reiterate what everyone else has already said, the first thing you should do when you have problems with Atlas is download Nikhil's tool (which I finally did).

The 500 error, in turn, has it's source in this error message --The state information is invalid for this page and might be corrupted.

So apparently using the update panel does something to the viewstate that makes the treeview not work properly anymore. But I can't disable viewstate since both the update panel and the treeview seem to need it.

So now that I've tracked down and isolated the error, It's still a stumper because, from looking throught the asp.net archives, it looks like the viewstate error is also a semi-mysterious problem in ASP.Net 2.0.

Help?

No comments:

Post a Comment