Deploy and use Microsoft's TreeView control in ASP.net

Source: Internet
Author: User
asp.net|treeview| Control | Microsoft I want to use a TreeView control to display the structure of the folder. There is no default TreeView control in ASP.net, so I looked up the information and knew that Microsoft had released its control iewebcontrols. I downloaded the control and installed it on my own machine.
1. Download:

Download the URL

http://msdn.microsoft.com/downloads/samples/internet/asp_dot_net_servercontrols/webcontrols/



2. Installation:

First, unzip and then run Builder.bat. Found the error, check a bit, the original is CSC.exe did not find. So, I modified the batch and added the full path to the file before CSC.exe, and the batch content became:

@if "%_echo%" = "" "Echo off



If not exist builds mkdir build



C:\windows\microsoft.net\framework\v1.1.4322/csc.exe/out:build\microsoft.web.ui.webcontrols.dll @ Iewebcontrols.rsp

xcopy Src\runtime build\runtime/e/y/i/q



Then, according to the readme prompts, a folder C:\Inetpub\wwwroot\webctrl_client is created under the default site, and then the "\1_0" folder is created under this folder, and then Copy the files in the Builder directory to this folder, which contains the following files:

/webctrl_client/1_0

Multipage.htc

Tabstrip.htc

Toolbar.htc

Treeview.htc

Webservice.htc

Webserviced.htc

[Images]

[Treeimages]

Then, copy the generated DLL file (Microsoft.Web.UI.WebControls.dll) to the bin directory under your newly created WEB application

3. Use

According to the example file provided, create a Web application, open the page you want to edit, and add the following sentences to the top:

<%@ Register tagprefix= "ie" namespace= "Microsoft.Web.UI.WebControls" assembly= "Microsoft.Web.UI.WebControls"% >



Place the control in the appropriate place:

<ie:treeview id= "TreeView1" runat= "Server" ></ie:TreeView></TD>



Alternatively, drag the control of the toolbox to the appropriate location by adding or removing the controls on the toolbox.

4, increase the node

If you need to write a fixed node, you can modify the "nodes" attribute in the control's properties to create a tree structure.

If, is dynamically generated, you must modify the CS code file. The steps might be as follows:

A, adding references

B, define the TreeView:

protected Microsoft.Web.UI.WebControls.TreeView TreeView1;

C, build nodes:

Microsoft.Web.UI.WebControls.TreeNode filenode1=new Microsoft.Web.UI.WebControls.TreeNode ();

D, set node properties

filenode1.text= "root node";

Filenode1.target= "Http://www.csdn.net";

E, add nodes to the TreeView

TREEVIEW1.NODES.ADD (FILENODE1);


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.