Previously, if you want to use the tree control in the web page, there will be some troubles, sometimes you should write the code yourself to reach the purpose of displaying the data with the tree list. In ASP.NET, we can easily use the Internet Exploer Web Controls control provided by Microsoft to implement the tree list. In Microsoft, this Internet Explore Web Controls control collection includes MultiPage, Tabstrip, Toolbar, TreeView controls. In this article, let's look at how to use the TreeView control and XML in ASP.NET to implement the tree list.
Microsoft's set of controls can be downloaded in http://asp.net/iewebcontrols/download.aspx?tabindex=0&tabid=1, and run the setup installation after downloading. Now let's try to make a simple example with the TreeView control.
In the new web project in VS.NET, then in the toolbox, the mouse button pops up, select "Add New Item", in the custom toolbox, select the TreeView control (Note that the namespace is Microsoft Internet EXPLOERE Web Control's namespace), you can appear in the toolbox in the toolbox.
Next, drag the TreeView control into the form, switch to the HTML view, then find the following code:
<% @ Register tagprefix = "IE" namespace = "microsoft.web.ui.webcontrols" assembly = "Microsoft.Web.ui.WebControls"%>
Of course, you can change the tagrefix tag value, for example, change to FOOBAR, then use the TreeView control, use it as follows:
Now, we can add all kinds of nodes to the tree by selecting the Nodes attributes in the property box of the TreeView control, which is not detailed herein. Below is the code after adding a variety of nodes: