简体   繁体   English

在treeview asp.net中需要帮助

[英]Need help in treeview asp.net

I'm using Microsoft.Web.UI.WebControls.TreeView in my existing project, which is not working in all browsers(IE10). 我在现有项目中使用了Microsoft.Web.UI.WebControls.TreeView,但并非在所有浏览器(IE10)中都可以使用。 After searching in Bing/Google I came to know that this treeview is no more in use, and has been replaced by System.Web.UI.WebControls.TreeView. 在Bing / Google中搜索后,我知道该树视图已不再使用,并已由System.Web.UI.WebControls.TreeView代替。 So I'm trying to replace the new treeview. 因此,我正在尝试替换新的Treeview。 Here I'm facing some issues with some properties. 在这里,我面临一些属性问题。 Can anyone tell me the equivalent properties for the new System.Web.UI.WebControls.TreeView? 谁能告诉我新的System.Web.UI.WebControls.TreeView的等效属性?

Microsoft.Web.UI.WebControls.TreeView TV1;

TV1.TreeNodeSrc = xml.OuterXml;

string index = TV1.SelectedNodeIndex;

txtObject.Text = TV1.GetNodeFromIndex(nodeIndex).Text;

tnDDAO = ((MSWebControls.TreeNode)TV1.GetNodeFromIndex(nodeIndex).Parent);

Try this 尝试这个

  1. Use an XML data source and use that as the data source of the TreeView 使用XML数据源并将其用作TreeView的数据源

See this example in MSDN 在MSDN中查看示例

  1. To get the index of the selected node use 获取所选节点的索引 ,请使用

    TreeView TV1 = new TreeView(); TreeView TV1 =新的TreeView(); TV1.Nodes.IndexOf(TV1.SelectedNode).ToString(); TV1.Nodes.IndexOf(TV1.SelectedNode).ToString();

  2. To get the Text of the selected node use 要获取所选节点的文本,请使用

    TreeView TV1 = new TreeView(); TreeView TV1 =新的TreeView(); txtObject.Text = TV1.SelectedNode.Text; txtObject.Text = TV1.SelectedNode.Text;

  3. To find a node use FindNode method 要查找节点,请使用FindNode方法

    TV1.FindNode TV1.FindNode

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM