ASP.NET TreeView control bug with NavigateUrl and Target



Hi all,

I have a problem with the ASP.NET 2.0 TreeView Control.

I have added some TreeNodes to my TreeView that has NavigationUrl set to a
webpage, Target set to "_blank" (a new windows) and SelectionMode set to
"Select". Then I added some other nodes that doesn't have NavigationUrl set
("regular" nodes).

When I first click a "regular" node and the page postbacks I read the
SelectedNode property and do whatever I need. Next, if I click a node with
NavigationUrl and Target set, the TreeView seems to be using javascript to
mark the node as selected (in the GUI, both nodes seems selected). It does
not postback and trigger the SelectedNodeChanged event but when my main page
postbacks (when I click a button or whatever) the SelectedNode property on
the TreeView is now changed to the node with NavigationUrl set.

This might be the intention of the .NET Framework, but it seems a little
strange since I want the nodes with NavigationUrl set to be "Navigation Only"
and not interfere with the regular nodes.

I tried to make a custom TreeView and TreeNode class, setting the nodes
selectionmode to "None" and then overriding the RenderPreText and
RenderPostText to render my own A-tag with correct Href- and
Target-attribute, but unfortunately I cannot access Css and Style attributes
and some other vital functions to render on my custom node like the regular
nodes since Microsoft has made all theese properties internal or private (I
checked them with reflector).

Does anyone have a better solution. Should this be considered a bug? If so,
where do I report this?


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

Latest member

Latest Threads