471,570 Members | 973 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,570 software developers and data experts.

wrong TreeView node selected

rfm
I have a TreeView with 1 expanded top node, it has several childnodes
(call it row A), which have childs of their own.

The top node is selected correctly and all childnodes from the row A
nodes are selected correctly.

But if I select (with the mouse) one of the nodes in row A it always
displays the first node in row A as selected.

Is this a bug in treeview or something, cause I can't think of any
reason it does this.

--

Jan 24 '07 #1
2 2297
Hi

http://munnacs.blogspot.com/2006/11/...ry-useful.html

This might help you

Thanks.
Masudur
www.kaz.com.bd
http://munnacs.blogspot.com
On Jan 24, 4:34 pm, "rfm" <i...@home.nlwrote:
I have a TreeView with 1 expanded top node, it has several childnodes
(call it row A), which have childs of their own.

The top node is selected correctly and all childnodes from the row A
nodes are selected correctly.

But if I select (with the mouse) one of the nodes in row A it always
displays the first node in row A as selected.

Is this a bug in treeview or something, cause I can't think of any
reason it does this.

--
Jan 24 '07 #2
rfm
Thanx, now I at least know why it doesn't work, apparently value needs
to be unique.
Problem is node.value needs to be the same for some nodes in my app.
So I found another solution.

Treeview_load is called before TreeView1_SelectedNodeChanged and
contains the correct selected node.
example:

public TreeNode selectedNode;

protected void TreeView1_SelectedNodeChanged(object sender,
EventArgs e)
{
if (selectedNode != null)
{
TreeView1.SelectedNode.Selected = false;
selectedNode.Select();
}
....
}

protected void TreeView1_Load(object sender, EventArgs e)
{
if (TreeView1.SelectedNode != null)
{
selectedNode = TreeView1.SelectedNode;
}
}
Masudur wrote:
Hi

http://munnacs.blogspot.com/2006/11/...trol-very-usef
ul.html

This might help you

Thanks.
Masudur
www.kaz.com.bd
http://munnacs.blogspot.com
On Jan 24, 4:34 pm, "rfm" <i...@home.nlwrote:
I have a TreeView with 1 expanded top node, it has several
childnodes (call it row A), which have childs of their own.

The top node is selected correctly and all childnodes from the row A
nodes are selected correctly.

But if I select (with the mouse) one of the nodes in row A it always
displays the first node in row A as selected.

Is this a bug in treeview or something, cause I can't think of any
reason it does this.

--


--

Jan 24 '07 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

6 posts views Thread by Tim | last post: by
7 posts views Thread by vsiat | last post: by
6 posts views Thread by L.M | last post: by
3 posts views Thread by Shawn | last post: by
2 posts views Thread by Claus | last post: by
8 posts views Thread by Matt MacDonald | last post: by
1 post views Thread by =?Utf-8?B?Rmx5Z3V5?= | last post: by
reply views Thread by XIAOLAOHU | last post: by
reply views Thread by leo001 | last post: by
reply views Thread by lumer26 | last post: by
reply views Thread by Vinnie | last post: by
reply views Thread by lumer26 | last post: by
reply views Thread by lumer26 | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.