将微软的TreeView瘦身
1。如果引用DLL,使用服务器端数控件,就是按常规步骤在工具栏中拖出一个树到页面上。
避免在wwwroot/下面copy webctrl_client目录的方法:
在Web.Config中加入
以下内容为程序代码:
<!--设置treeview的路径--> <configSections> <section name="MicrosoftWebControls" type="System.Configuration.NameValueSectionHandler, System, Version=1.0.2226.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" /> </configSections> <MicrosoftWebControls> <add key="CommonFiles" value="/PASS/webctrl_client/1_0/" /> </MicrosoftWebControls>
| |
2.直接在页面上利用下面的代码
以下内容为程序代码:
<?XML:NAMESPACE PREFIX=TVNS /> <?IMPORT NAMESPACE=TVNS IMPLEMENTATION="/PASS/includes/HTC/treeview.htc" /> <tvns:treeview id="tvwDeptTree" defaultStyle="font-family:verdena;font-size:9pt;color:black;" selectedNodeIndex="0" HelperID="__tvwDeptTree_State__" systemImagesPath="/PASS/media/treeimages/" onexpand="javascript: if (this.clickedNodeIndex != null) this.queueEvent('onexpand', this.clickedNodeIndex)" oncollapse="javascript: if (this.clickedNodeIndex != null) this.queueEvent('oncollapse', this.clickedNodeIndex)" oncheck="javascript: if (this.clickedNodeIndex != null) this.queueEvent('oncheck', this.clickedNodeIndex)" onselectedindexchange="javascript: if (event.oldTreeNodeIndex != event.newTreeNodeIndex) this.queueEvent('onselectedindexchange', event.oldTreeNodeIndex + ',' + event.newTreeNodeIndex)"> <tvns:treenode Expanded="True" Selected="true">xxx <tvns:treenode>xxx</tvns:treenode> <tvns:treenode>xxxtvns:treenode> <tvns:treenode>xxx <tvns:treenode>WW0</tvns:treenode> </tvns:treenode> <tvns:treenode>xxx(<tvns:treenode>xxx</tvns:treenode> </tvns:treenode> <tvns:treenode>xxx <tvns:treenode>DD0</tvns:treenode> </tvns:treenode> </tvns:treenode> </tvns:treeview>
| |