I have a problem with the ScrollIntoView() method in that it is acting erratically. Initially I had implemented this code:
nodeToMove.Attributes.Add("Moved", "1");
And then I altered the latter function like this:
function ScrollToSelectedNode()
{
var tree = <%= treeViewMain.ClientID %>;
var selectedNode = tree.SelectedNode;
if (selectedNode != null && selectedNode.Attributes.Moved == "1")
{
selectedNode.ScrollIntoView();
selectedNode.Attributes.Moved = "0";
}
}
My problem is this: I tried to remove the "Moved" attribute but couldn't figure out how. And then when its value was [supposedly] set to "0" it didn't "stick". On the next partial-postback its value had returned to "1" ... for reasons I don't understand.
Might anyone have any ideas?
Robert
function pageLoad()
{
setTimeout('ScrollToSelectedNode()', 200);
}
function ScrollToSelectedNode()
{
var tree = <%= treeViewMain.ClientID %>;
var selectedNode = tree.SelectedNode;
if (selectedNode != null)
selectedNode.ScrollIntoView();
}
nodeToMove.Attributes.Add("Moved", "1");
And then I altered the latter function like this:
function ScrollToSelectedNode()
{
var tree = <%= treeViewMain.ClientID %>;
var selectedNode = tree.SelectedNode;
if (selectedNode != null && selectedNode.Attributes.Moved == "1")
{
selectedNode.ScrollIntoView();
selectedNode.Attributes.Moved = "0";
}
}
My problem is this: I tried to remove the "Moved" attribute but couldn't figure out how. And then when its value was [supposedly] set to "0" it didn't "stick". On the next partial-postback its value had returned to "1" ... for reasons I don't understand.
Might anyone have any ideas?
Robert