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