M
Magnusb
I have a web page with a Treeview. Problem is when you for example
expand a node and the page is refreshed the position in the treeview
returns to top, which means you have to scroll the treeview to get back
to your previous position. What I want is the treeview to maintain the
position in the treeview.
I have tried to inject (from code behind) a Javascript which does
something like this: (I am actually usign something like in this
article:
http://www.codeguru.com/csharp/.net/net_asp/scripting/article.php/c12869
)
<script>
function LoadEvent()
{
try
{
var elem = document.getElementById('TreeView1_SelectedNode');
if(elem != null )
{
var node = document.getElementById(elem.value);
if(node != null)
{
node.scrollIntoView(true);
Panel1.scrollLeft = 0;
}
}
}
catch(oException)
{}
}// -->
</script>
But it is still not working. I am not sure if there is something else
which affect the execution (for example something that is executed after
my javascript has run).
I am using a master/content page where my treeview is in the content
page. The treeview control i sembeed in a user control.
expand a node and the page is refreshed the position in the treeview
returns to top, which means you have to scroll the treeview to get back
to your previous position. What I want is the treeview to maintain the
position in the treeview.
I have tried to inject (from code behind) a Javascript which does
something like this: (I am actually usign something like in this
article:
http://www.codeguru.com/csharp/.net/net_asp/scripting/article.php/c12869
)
<script>
function LoadEvent()
{
try
{
var elem = document.getElementById('TreeView1_SelectedNode');
if(elem != null )
{
var node = document.getElementById(elem.value);
if(node != null)
{
node.scrollIntoView(true);
Panel1.scrollLeft = 0;
}
}
}
catch(oException)
{}
}// -->
</script>
But it is still not working. I am not sure if there is something else
which affect the execution (for example something that is executed after
my javascript has run).
I am using a master/content page where my treeview is in the content
page. The treeview control i sembeed in a user control.