Hi, I am trying to select a node in a treeview, but the problem is that the scroll does not go to the right position. Anyone knows how to do it? Thanks in advance
I have same problem as you...if you get any idea then let me know
Thanks in advance
Regards,
Jagdish Sakhiya
IVAPS Pvt LTD, Bangalore
AND ME TOO!! I find some said "in javascript get the nodeid.then use .node.scrollIntoView" ..But it doesn"t work ..ie pro:document.all(...)is null.or the object haven't the mothed...
If so, the Element ID convention is TreeView.ID + Node Index.
The javascript syntax to scroll to the 99th node on a TreeView whose ID is "TreeView" is:
document.all("TreeView99").scrollIntoView(true);
I have been trying to find the elementID of a node, and can't seem to get it (with the new ASP.Net 2.0 TreeView). In the Web Control version (pre 2.0) I could programmatically select the node, then register a client side script to ZoomToSelectedNode, which
worked great. Unfourtunately, in ASP.Net 2.0 the tree view doesn't seem to support TreeView.selectedNodeIndex (javascript property). I am still working on it!
If you are using the older version of the web control, I can give you specific code examples of how to do it.
apicazo
Member
5 Points
1 Post
Scroll to selected node treeview
Mar 11, 2005 04:31 PM|LINK
fulin_321
Member
5 Points
1 Post
Re: Scroll to selected node treeview
Mar 15, 2005 08:46 AM|LINK
jagdish_ce
Member
45 Points
9 Posts
Re: Scroll to selected node treeview
Sep 23, 2005 12:04 PM|LINK
Hi,
I have same problem as you...if you get any idea then let me know
Thanks in advance
Regards,
Jagdish Sakhiya
IVAPS Pvt LTD, Bangalore
dingonet
Member
15 Points
3 Posts
Re: Scroll to selected node treeview
Oct 25, 2005 07:27 AM|LINK
AND ME TOO!! I find some said "in javascript get the nodeid.then use .node.scrollIntoView" ..But it doesn"t work ..ie pro:document.all(...)is null.or the object haven't the mothed...
mjkrsk
Member
10 Points
2 Posts
Re: Scroll to selected node treeview
Nov 09, 2005 03:56 AM|LINK
If so, the Element ID convention is TreeView.ID + Node Index.
The javascript syntax to scroll to the 99th node on a TreeView whose ID is "TreeView" is:
document.all("TreeView99").scrollIntoView(true);
I have been trying to find the elementID of a node, and can't seem to get it (with the new ASP.Net 2.0 TreeView). In the Web Control version (pre 2.0) I could programmatically select the node, then register a client side script to ZoomToSelectedNode, which worked great. Unfourtunately, in ASP.Net 2.0 the tree view doesn't seem to support TreeView.selectedNodeIndex (javascript property). I am still working on it!
If you are using the older version of the web control, I can give you specific code examples of how to do it.
jagdish_ce
Member
45 Points
9 Posts
Re: Scroll to selected node treeview
Dec 28, 2005 04:36 AM|LINK
Hi,
Thanks for help........ Can you send me code....so, i can understand it.........
Thanks in advance
Regards,
Jagdish Sakhiya
ruwansira
Member
5 Points
1 Post
Re: Scroll to selected node treeview
Jan 20, 2006 03:43 AM|LINK
Hi,
I have the same problem. Thanks for your ideas........ Can you send the code me also....then, i can understand it.........
Thanks in advance
Regards,
- Ruwan Siriwardena
groggy
Member
5 Points
1 Post
Re: Scroll to selected node treeview
Mar 29, 2006 06:15 AM|LINK
Hi,
Can you send me the specific code examples....
Thanks in advance
Regards,
Timo Korhonen
jptrue
Member
65 Points
16 Posts
Re: Scroll to selected node treeview
May 16, 2006 04:55 PM|LINK
I have found a solution that works for me:
//the client-side ID of the SelectedNode of TreeView1 is//stored in an hidden input named TreeView1_SelectedNode
var inpSelectedNode = document.getElementById("TreeView1_SelectedNode");
if (inpSelectedNode.value != "")
{
var objScroll = document.getElementById(inpSelectedNode.value);
//my treeview is contained in a scrollable div element
divTree2.scrollTop = findPosY(objScroll);//this works as well bu, but there is not as much control over the y position
//document.all(inpSelectedNode.value).scrollIntoView(true);}
function findPosX(obj){
var curleft = 0; if (obj.offsetParent){
while (obj.offsetParent){
curleft += obj.offsetLeft
obj = obj.offsetParent;
}
}
else if (obj.x)curleft += obj.x;
return curleft;}
function
findPosY(obj){
var curtop = 0; if (obj.offsetParent){
while (obj.offsetParent){
curtop += obj.offsetTop
obj = obj.offsetParent;
}
}
else if (obj.y)curtop += obj.y;
return curtop;}
The findPosY function was "borrowed" from here:
http://www.quirksmode.org/js/findpos.html
Thanks,
Jeff
radishj
Member
117 Points
24 Posts
Re: Scroll to selected node treeview
Sep 19, 2006 02:11 AM|LINK
Hi,
I tried your solution.
How come document.getElementById("TreeView1_SelectedNode") return me a NULL?
Did you try this code in ASP 2.0?
Thanks