ASP.Net TreeView的滚动选择的节点进入视野 [英] ASP.Net TreeView Scrolling the selected node into view
问题描述
有没有办法来一个ASP.Net的TreeView的选定节点滚动到视图回传后?
Is there a way to scroll the selected node of an ASP.Net TreeView into view after a postback?
在我parrticular情况下控制在每次回发后重新填充。
In my parrticular scenario the control is repopulated after each postback.
谢谢!
推荐答案
我想通了。 TreeView控件创建客户端的JavaScript对象。它被命名为任何你叫树视图以'_Data追加。对象可以让你所选择的节点的引用。
I figured it out. The TreeView control creates a javascript object on the client. It is named whatever you called the treeview with a '_Data' appended. The object lets you get a reference to the selected node.
下code使用ASP.Net AJAX扩展。只记得到TreeView名称更改为任何你叫你的。
The code below uses the ASP.Net Ajax extensions. Just remember to change the TreeView name to whatever you called yours.
var name = myTreeView_Data.selectedNodeID.value;
var selectedNode = $get(name);
if(selectedNode)
{
selectedNode.scrollIntoView(true);
}
这篇关于ASP.Net TreeView的滚动选择的节点进入视野的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!