Wrox Programmer Forums
|
ASP.NET 1.1 As of 10/6/2005, this forum is locked as part of the reorganization described here: http://p2p.wrox.com/topic.asp?TOPIC_ID=35394. No posts have been deleted. Open ongoing discussions from the last week have been moved to either ASP.NET 1.0 and 1.1 Beginners http://p2p.wrox.com/asp-net-1-0-1-1-basics-60/ or ASP.NET 1.0 and 1.1 Professional. http://p2p.wrox.com/forum.asp?FORUM_ID=50. See my sticky post inside for more.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 1.1 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old October 15th, 2004, 10:48 AM
Authorized User
 
Join Date: Sep 2004
Posts: 47
Thanks: 0
Thanked 0 Times in 0 Posts
Default TreVIew

Hi,

is there anyway i can get a left and top position of any particular treenode using javascript?

var selnode=TreeView1.getTreeNode(TreeView1.selectedNo deIndex);
alert(selnode.getAttribute("__Top"));
alert(selnode.getAttribute("__Left"));

something like that...but that doesn;t work...

thank you.

 
Old October 15th, 2004, 11:07 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 1,998
Thanks: 0
Thanked 3 Times in 3 Posts
Default

If anything, you would want to access the style attribute, that would have a left: and top: identifier.

Brian
 
Old October 18th, 2004, 10:57 AM
Authorized User
 
Join Date: Sep 2004
Posts: 47
Thanks: 0
Thanked 0 Times in 0 Posts
Default

no style attribute did not work..style attribute returns null

is there anyway i can get a left and top position of any particular treenode using javascript?

var selnode=TreeView1.getTreeNode(TreeView1.selectedNo deIndex);
alert(selnode.getAttribute("__Top"));
alert(selnode.getAttribute("__Left"));

something like that...but that doesn;t work...

i know about the mouse click position...

so it's not exactly the clicked node position it's rather the mouse click position..

say there is

Node 1(Expanded)
  |___
  |___
Node 2(CollapseD)

now when user clicks node2 i can get the position using window.event.clientX....but when node2 is expanded and node1 is collapsed...

so node 2 moves up

Node1
Node2
  |__
  |__

so node2 moves up...so the position i got using window.event.clientX is no more the position where node 2 is...

thank you.

i am trying using

TreeView1.getTreeNode(TreeView1.selectedNodeIndex) .getAttribute("offsetTop"); but tha actually yields 0;

(http://www.mozilla.org/docs/dom/domref/dom_el_ref.html)


 
Old October 19th, 2004, 06:59 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 1,998
Thanks: 0
Thanked 3 Times in 3 Posts
Default

Hey,

Did you try:

alert(selnode.getAttribute("top"));
alert(selnode.getAttribute("left"));

Or maybe:

alert(selnode.getAttribute("style"));

Brian
 
Old October 19th, 2004, 09:07 AM
Authorized User
 
Join Date: Sep 2004
Posts: 47
Thanks: 0
Thanked 0 Times in 0 Posts
Default

yep brain i have tried all that...seems like if i set the style property for every node then it would give me style what i set...but it doesn't really matter since i can never set left and top even though i did..it's going to neglect it since it can't guarentee node will be placed there...

seems like all this would work in HTML javascript Tree it would work but since this is ASP.net it wouldn't..for some reason..

Thanks for trying though.


 
Old October 20th, 2004, 07:07 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 1,998
Thanks: 0
Thanked 3 Times in 3 Posts
Default

If it works with an HTML javascript Tree, you could create your own .NET control that renders the tree out and create your own functions to interface with it. Of course, interfacing with nodes will cause a postback.

Also, I don't think I established this... Are you using the Microsoft Web controls version of the treeview, or an HTML one with runat="server"?

Lastly, to try to get the properties with javascript, could you copy/paste into a reply the HTML markup for the treeview?

Brian
 
Old October 21st, 2004, 09:57 AM
Authorized User
 
Join Date: Sep 2004
Posts: 47
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Are you using the Microsoft Web controls version of the treeview, or an HTML one with runat="server"?

I am using Microsoft Web Controls version of TreeView...

..how do i use the HTML one i with runat="server".

Thanks for your help.



 
Old October 21st, 2004, 12:07 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 1,998
Thanks: 0
Thanked 3 Times in 3 Posts
Default

I was asking, because you said it worked with the HTML javascript tree. I never heard of that.

Brian
 
Old October 21st, 2004, 12:41 PM
Authorized User
 
Join Date: Sep 2004
Posts: 47
Thanks: 0
Thanked 0 Times in 0 Posts
Default

oh ok well...i guess HTML Tree is some javascript code ..i mean there is actually no control...

hmm thanks anyways.






Similar Threads
Thread Thread Starter Forum Replies Last Post
Access 2003 Treview simmyboy Access 5 July 18th, 2006 02:51 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.