Asp. NET using the TreeView and XML

Source: Internet
Author: User
In the past, if you wanted to use a tree control on a Web page, it would be a bit cumbersome, and sometimes even write your own code to achieve the goal of displaying the data in a tree-shaped list. In asp.net, we can easily use the Internet Exploer Web controls control provided by Microsoft to implement a tree list. In the set of Internet Exploere Web controls controls provided by Microsoft, there are Multipage,tabstrip,toolbar,treeview controls. In this article, we look at how the TreeView control and XML are used in asp.net to implement a tree list.
Microsoft's set of controls can be downloaded in the http://asp.net/IEWebControls/Download.aspx?tabindex=0&tabid=1, download and then run the setup installation. Now let's try a simple example with the TreeView control.
Create a new Web project in Vs.net, then in the Toolbox, right-click the menu, select Add New Item, and in the custom Toolbox, select the TreeView control (note that the namespace is selected for the Microsoft Internet Exploere Web control's namespace), you can appear in the toolbox when you are sure.
Next, drag the TreeView control onto the form and switch to HTML view, where you'll find the following code:
<%@ Register tagprefix= "ie"
Namespace= "Microsoft.Web.UI.WebControls"
Assembly= "Microsoft.Web.UI.WebControls"%>
Of course, you can change the tagprefix tag value, for example, to Foobar, then when referencing the TreeView control, refer to the following:
<foobar:treeview runat= "Server" .../>
Now we can add a variety of nodes to the tree by selecting the Nodes property in the TreeView control's property box, which is not covered in detail because it is relatively simple. Here is the code after the various nodes have been added:
<form runat= "Server" >
<ie:treeview runat= "Server" >
<ie:treenode text= "Isaac Gibson" expanded= "True"
<ie:treenode text= "Birth-1766"/>
<ie:treenode text= "Death-1827"/>
<ie:treenode text= "Spouse"
<ie:treenode text= "Ritty Gibson"/>
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.