TreeView with updatePanel problem

R

Ringdrossel

Hi I use the TreeView control inside an ajax update panel. This is working
fine till I just implement the TreeNodeExpanded event. Even without writing
any code inside that implementation!

Here is what happens:

I got a tree structure like

root
- node
-- subnode1
--- subnode1.1
---- subnode1.1.1
--- subnode1.2
-- subnode2
- node2

I open the root everything is fine. I open subnode 1 everything is fine, too.
Now I open subnode1.1 and subnode1 (parent of subnode1.1) closes!
What the???

Here is the code I used to implement that special event:

Protected Sub CategoryTreeView_TreeNodeExpanded(ByVal sender As
System.Object, ByVal e As System.Web.UI.WebControls.TreeNodeEventArgs)
Handles CategoryTreeView.TreeNodeExpanded
'really no code here!!
End Sub

What happens when I debug the code is:

The first time TreeNodeExpanded is called correctly.
But then a full Postback is done.
Next is a new call to TreeNodeCollapsed
-> here the parent of the subnode1.1 is the object calling this handler
(subnode1)!
-> this has the property expanded=false! whyever!
Next another postback is done
Next finally TreeNodeExpanded gets called again with subnode1.1
where expanded property is true!

Did anybody experience the same problem? And if so does a good workaround
exist? I read a fix where in every event of this type: expanded, collapsed,
selectedNodeChange you suppress the closing of the root node but this didn't
solve
my problem since its not the root node but the parent node that wants to
close.

This drove me crazy- perhaps someone has a solution?

Regards Sven
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,537
Members
45,021
Latest member
AkilahJaim

Latest Threads

Top