简体   繁体   中英

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). 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. So I'm trying to replace the new 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?

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

See this example in MSDN

  1. To get the index of the selected node use

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

  2. To get the Text of the selected node use

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

  3. To find a node use FindNode method

    TV1.FindNode

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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