Use Treeview and XML in ASP. NET

Source: Internet
Author: User

In the past, if you wanted to use a tree control on a WEB page, it was often a little troublesome. Sometimes you even had to write your own code to display data in a tree list. In asp.net, we can easily use the Internet Exploer Web Controls control provided by Microsoft to implement a tree list. This set of Internet Exploere Web Controls provided by Microsoft includes MultiPage, TabStrip, TOOLbar, and Treeview Controls. In this article, we will look at how to use the Treeview control and XML in ASP.net to implement a tree-like list.
Microsoft's control set can be in http://asp.net/IEWebControls/Download.aspx? Download tabindex = 0 & tabid = 1, and run setup to install it. Now let's try to use the Treeview control as a simple example.
Create a new WEB project in vs.net. in the toolbox, right-click the shortcut menu and select "Add new project". In the custom toolbox, select the TREEVIEW control (note that the namespace is the Microsoft Internet Exploere web control namespace). After you press OK, you can see the Treeview control in the toolbox.
Drag the treeview control to the form and switch to the HTML view. The following code is displayed:
<% @ Register TagPrefix = "ie"
Namespace = "Microsoft. Web. UI. WebControls"
Assembly = "Microsoft. Web. UI. WebControls" %>
Of course, you can change the tag value of TagPrefix, for example, to FooBar. In the future, when you reference the Treeview control, reference it as follows:
<FooBar: TreeView runat = "server".../>
Now, you can click the nodes attribute in the properties box of the Treeview control to add nodes to the tree. This is not detailed here because it is relatively simple. The following code adds nodes:
<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"/>

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.