.Net中使用TreeView控件的方法

来源:互联网 发布:java开源代码库 编辑:程序博客网 时间:2024/05/17 04:59

1.一般方法:

(1)下载的treeview控件以后减压生成Microsoft.Web.UI.WebControls.dll
(2)在wwwroot下创建空目录webctrl_client/1_0。
(3)将build/Runtime下的文件拷至webctrl_client/1_0下。
(4)选择工具箱的自定义工具箱,添加Microsoft.Web.UI.WebControls.dll。
这里初始化的环境配置好了,在命名空间里才能找到这个控件
在.cs里面最好加上using Microsoft.Web.UI.WebControls
TreeView要求客户端浏览器版本为IE5.5及以上,最好要求客户端升级为IE6.0

【注:如果项目不在wwwroot目录下,webctrl_client/1_0目录要放在项目所在的WebSite下】

2.简便方法:

以前在服务器部署IEWebcontrol时,需要装完asp.net站点后,再安装iewebcontrols,比较麻烦。其实在web.config文件中配置一下就可以了,不需要安装。在<configuration>下添加:

<configSections>

<section name="MicrosoftWebControls" type="System.Configuration.NameValueSectionHandler, System, System.Configuration.NameValueSectionHandler, System, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />

</configSections>

<MicrosoftWebControls>

     <add key="CommonFiles" value="/website/webctrl_client/1_0" />

</MicrosoftWebControls>

【附:Microsoft.Web.UI.WebControls.dll组件的生成方法】

IE Web Controls
1、双击安装完成,默认:系统盘:/program files/IE Web Controls目录下。
2、运行“程序——Microsoft Visual Studio.NET 2003 ——Visual Studio.NET 工具 ——Microsoft Visual Studio.NET 2003 命令提示符”,进入到IE Web Control 安装目录。
3、运行build.bat 。
4、运行xcopy /s /i ./build/Runtime (网站根目录,默认系统盘):/Inetpub/wwwroot/webctrl_client/1_0 /y 。(webctrl_client/1_0 /若没有须自己创建空目录,y是C:/Program Files/IE Web Controls/build/Runtime下的文件
[C:/Program Files/IE Web Controls是IE Web Controls的安装路径]

在”工具箱——web窗体“单击右键,选择“添加/移除项...”,在弹出对话框中选择.net framwork 组件,单击“浏览”,找到IE WebControl.dll 文件,添加上即可。

原创粉丝点击