Welcome Guest Search | Active Topics | Sign In | Register

Select a node in a TreeView control Options
ITMA
Posted: Thursday, April 14, 2011 2:20:22 AM
Rank: Advanced Member
Groups: Member

Joined: 6/23/2010
Posts: 48
Hi,

Is there a similar way of selecting a treeview item as when from code behind selecting a tab in a tabstrip?
(eg. “tabstrip1.SelectedIndex = CInt(Session("PersType")) – 1”)

As the treeview is also based on navigation item (?), I assume that there is a similar way of doing this, but when using the treeview control.

Best regards,

ITMA
eo_support
Posted: Thursday, April 14, 2011 7:39:09 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,194
Hi,

No. There is no directly equivalent to selectedIndex on the TreeView. You can use index to get a TreeNode object and then set that TreeNode's Selected to true. Please see the reference for more details.

Thanks!
ITMA
Posted: Thursday, April 14, 2011 10:30:53 AM
Rank: Advanced Member
Groups: Member

Joined: 6/23/2010
Posts: 48
Well... / Thank's

Sometimes the answers might be somewhat simplified. I have actually studied the references in the documentation, but without finding an article that deals with the case from my perspective.

Of course it has something to do with me not having control from a personal perspective. But invested hours in an issue that should be relatively easy to solve creates frustration. I know about your policy, understand it and respect it therefore. But how difficult and contradictory to your policy does it need to be if your response includes a reference to an example or article in your documentation.

This would save considerable resources for both parties. This kind of answer actually only gives a hint of that there might be a solution on the topic, not that there is. As, why is the treeview different from the tabstrip as both of them is a navigation object?

I don't wish to be rude. Im just frustrated.

Best regards,

ITMA
ITMA
Posted: Thursday, April 14, 2011 10:44:40 AM
Rank: Advanced Member
Groups: Member

Joined: 6/23/2010
Posts: 48
I've tried this,

Dim SelNode As EO.Web.TreeNode = TreeView1.SelectedNode
SelNode.Value = 672
SelNode.Selected = True

with result:

Object reference not set to an instance of an object.


As:

SelNode.Index = 672

As / with result that:

Property 'Index' is 'read only'.



Best & Thank's,

ITMA
eo_support
Posted: Thursday, April 14, 2011 10:46:47 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,194
Hi,

I understand your frustration and we certainly do not consider your response as rude. But at the same time we can not just provide solutions completely from our customer’s perspective whenever needed. There are millions of different scenarios and every programmer has a different task. We would be basically coding for them if we were to do that, so we can not afford to do it. As a result, we always require you to be able to look up the reference yourself.

If you have problem using the reference, or have questions regarding a specific reference topic (or any documentation topic), then we will be happy to help. We will not be your live librarian to help you to search a reference topic because the reference is already clearly organized by classes.

As to your question about why TreeView does not have a SelectedIndex property as the TabStrip control, the reason is because TreeView are almost ways multiple levels while TabStrip are almost always one level. You can use a single index to select an item within one level but that would not be sufficient for multiple levels. Also TreeView can have multiple selected nodes. TabStrip can not have multiple selected nodes. That's another case a single index isn't enough.

Thanks
ITMA
Posted: Thursday, April 14, 2011 2:31:14 PM
Rank: Advanced Member
Groups: Member

Joined: 6/23/2010
Posts: 48
Hi!

Thanks for your answer...

I understand and appreciate your effort. Out from your reply I also realize that what I'm striving for is not able to achieve because of the "multi lever" architecture you're describing. I have to consider something else.

Again thanks for your help that actually brought me to another level of understanding.

Best regards!


ITMAApplause


You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.