帮改改有关treeview代码

问题描述

<%@PageLanguage="C#"%><html><head><style><!--.skin1{cursor:default;font:menutext;position:absolute;text-align:left;font-family:Arial,Helvetica,sans-serif;font-size:10pt;width:120px;background-color:menu;border:1solidbuttonface;visibility:hidden;border:2outsetbuttonhighlight;}.menuitems{padding-left:15px;padding-right:10px;}--></style><scripttype="text/javascript"><!--Beginvarmenuskin="skin1";vardisplay_url=1;//ShowURLsinstatusbar?functionshowmenuie5(){if(event.srcElement.type!=undefined){vars=event.srcElement.id;varind=s.replace("TreeView1t","");s=s.replace("TreeView1t","TreeView1n");document.getElementById('one').url=event.srcElement.href;document.getElementById('one').innerText="Select";varch=document.getElementById(s);if(ch!=null){document.getElementById('two').url="javascript:TreeView_ToggleNode(TreeView1_Data,"+ind+","+s+",'',"+s+"Nodes)";document.getElementById('two').innerText="Expand\Collapse";}elsedocument.getElementById('two').outerHTML="<divid=twoclass=menuitemsurl=''></div>"varrightedge=document.body.clientWidth-event.clientX;varbottomedge=document.body.clientHeight-event.clientY;if(rightedge<ie5menu.offsetWidth)ie5menu.style.left=document.body.scrollLeft+event.clientX-ie5menu.offsetWidth;elseie5menu.style.left=document.body.scrollLeft+event.clientX;if(bottomedge<ie5menu.offsetHeight)ie5menu.style.top=document.body.scrollTop+event.clientY-ie5menu.offsetHeight;elseie5menu.style.top=document.body.scrollTop+event.clientY;ie5menu.style.visibility="visible";}else{ie5menu.style.visibility="hidden";}returnfalse;}functionhidemenuie5(){ie5menu.style.visibility="hidden";}functionhighlightie5(){if(event.srcElement.className=="menuitems"){event.srcElement.style.backgroundColor="highlight";event.srcElement.style.color="white";if(display_url)window.status=event.srcElement.url;}}functionlowlightie5(){if(event.srcElement.className=="menuitems"){event.srcElement.style.backgroundColor="";event.srcElement.style.color="black";window.status="";}}functionjumptoie5(){if(event.srcElement.className=="menuitems"){if(event.srcElement.getAttribute("target")!=null)window.open(event.srcElement.url,event.srcElement.getAttribute("target"));elsewindow.location=event.srcElement.url;}}//End--></script></head><body><formid="form1"runat="server"><divid="ie5menu"class="skin0"onmouseover="highlightie5()"onmouseout="lowlightie5()"onclick="jumptoie5();"><divid="one"class="menuitems"url=""></div><divid="two"class="menuitems"url=""></div></div><asp:TreeViewID="TreeView1"runat="server"><Nodes><asp:TreeNodeText="a"Value="a"><asp:TreeNodeText="b"Value="b"><asp:TreeNodeText="c"Value="c"></asp:TreeNode></asp:TreeNode></asp:TreeNode><asp:TreeNodeText="cc"Value="cc"><asp:TreeNodeText="ccc"Value="ccc"><asp:TreeNodeText="cccc"Value="cccc"></asp:TreeNode></asp:TreeNode></asp:TreeNode></Nodes><SelectedNodeStyleBackColor="#C00000"/></asp:TreeView></form><scripttype="text/javascript">if(document.all){ie5menu.className=menuskin;document.getElementById('TreeView1').oncontextmenu=showmenuie5;document.body.onclick=hidemenuie5;}</script></body></html>这个用的是以前版本的treeview控件,想改成2.0的treeview控件,怎么改啊,功能不要变

解决方案

解决方案二:
不是上面的是下面这段代码TreeView.aspx<%@RegisterTagPrefix="iewc"Namespace="Microsoft.Web.UI.WebControls"Assembly="Microsoft.Web.UI.WebControls,Version=1.0.2.226,Culture=neutral,PublicKeyToken=31bf3856ad364e35"%><HTML><HEAD><title>TreeView控件右键菜单</title><style><!--.skin{cursor:default;font:menutext;position:absolute;text-align:left;font-family:Arial,Helvetica,sans-serif;font-size:10pt;width:120px;background-color:menu;border:1solidbuttonface;visibility:hidden;border:2outsetbuttonhighlight;}.menuitems{padding-left:15px;padding-right:10px;}--></style></HEAD><bodyonclick="hideMenu()"><formid="TreeView"method="post"runat="server"><iewc:TreeViewid="TreeView1"runat="server"ExpandLevel="3"HoverStyle="color:blue;background:#ffff00;"><iewc:TreeNodeText="Node0"Expanded="True"><iewc:TreeNodeText="Node3"><iewc:TreeNodeText="Node5"></iewc:TreeNode><iewc:TreeNodeText="Node6"></iewc:TreeNode></iewc:TreeNode><iewc:TreeNodeText="Node4"></iewc:TreeNode></iewc:TreeNode><iewc:TreeNodeText="Node1"Expanded="True"><iewc:TreeNodeText="Node7"><iewc:TreeNodeText="Node8"></iewc:TreeNode></iewc:TreeNode></iewc:TreeNode><iewc:TreeNodeText="Node2"Expanded="True"><iewc:TreeNodeText="Node9"></iewc:TreeNode><iewc:TreeNodeText="Node10"><iewc:TreeNodeText="Node11"></iewc:TreeNode><iewc:TreeNodeText="Node12"></iewc:TreeNode></iewc:TreeNode></iewc:TreeNode></iewc:TreeView><divid="popupMenu"class="skin"onMouseover="highlighItem()"onMouseout="lowlightItem()"onClick="clickItem()"><divclass="menuitems"func="add">添加</div><hr><divclass="menuitems"func="delete">删除</div><divclass="menuitems"func="modify">修改</div></div></form><scriptlanguage="javascript">varmenuskin="skin";varnode=null;functionhideMenu(){popupMenu.style.visibility="hidden";}functionhighlighItem(){if(event.srcElement.className=="menuitems"){event.srcElement.style.backgroundColor="highlight";event.srcElement.style.color="white";}}functionlowlightItem(){if(event.srcElement.className=="menuitems"){event.srcElement.style.backgroundColor="";event.srcElement.style.color="black";window.status="";}}functionclickItem(){if(event.srcElement.className=="menuitems"){if(event.srcElement.getAttribute("func")=="add"&&node!=null){varnewNode=TreeView1.createTreeNode();newNode.setAttribute("Text","newNode");node.add(newNode);}elseif(event.srcElement.getAttribute("func")=="delete"&&node!=null){node.remove();}elseif(event.srcElement.getAttribute("func")=="modify"&&node!=null){node.setAttribute("Text","hgknight");}}}functionTreeView1.oncontextmenu(){varnodeIndex=event.treeNodeIndex;if(typeof(nodeIndex)=="undefined"){node=null;returnfalse;}node=TreeView1.getTreeNode(nodeIndex);varrightedge=document.body.clientWidth-event.clientX;varbottomedge=document.body.clientHeight-event.clientY;if(rightedge<popupMenu.offsetWidth){popupMenu.style.left=document.body.scrollLeft+event.clientX-popupMenu.offsetWidth;}else{popupMenu.style.left=document.body.scrollLeft+event.clientX;}if(bottomedge<popupMenu.offsetHeight){popupMenu.style.top=document.body.scrollTop+event.clientY-popupMenu.offsetHeight;}else{popupMenu.style.top=document.body.scrollTop+event.clientY;}popupMenu.style.visibility="visible";returnfalse;}</script></body></HTML>
解决方案三:
右键点击treenode有add、delete、modify功能
解决方案四:
好多呀。这就研究了这些。
解决方案五:
你先写好右键菜单,菜单里有add,delete,modify,然后逐一写事件就可以了http://www.cnblogs.com/zhangpengshou/archive/2008/11/16/1334377.htmlhttp://dev.csdn.net/article/26/26468.shtm
解决方案六:
汗...up。
解决方案七:
csdn

时间: 2024-11-08 21:55:11

帮改改有关treeview代码的相关文章

for-谁帮我改改这段代码问题出在哪里?

问题描述 谁帮我改改这段代码问题出在哪里? int score; //每门课成绩 int sum = 0; //成绩之和 double avg = 0.0; //平均分 Console.WriteLine(""请输入学生姓名:""); string name = Console.ReadLine(); for (int i = 0; i < 5; i++) { Console.Write(""请输入五门课中第""+(i+

控制器-谁帮我改改下面的代码

问题描述 谁帮我改改下面的代码 将下面的一般处理程序改为控制器代码 public class uptupian : IHttpHandlerIRequiresSessionState { public void ProcessRequest(HttpContext context) { context.Response.ContentType = ""text/plain""; HttpFileCollection files = context.Request.F

css百度分享-请高手帮改一个CSS代码 让百度分享和文章链接并排

问题描述 请高手帮改一个CSS代码 让百度分享和文章链接并排 .Article-Tool{ border:1px solid #c3d4e7; position:relative; top:-1px; text-align:right; padding:8px; vertical-align:middle; height:15px; background-color:#f4f8fd} .Article-Tool a{width:16px;height:16px;line-height:16px;

哪位大神能帮我解读一下代码 万分感谢

问题描述 哪位大神能帮我解读一下代码 万分感谢 有关色偏检测的 double operation::colorCastDetection(IplImage pFrame) { IplImage labFrame = cvCreateImage(cvGetSize(pFrame),pFrame->depth,pFrame->nChannels); cvCvtColor(pFrame,labFrame,CV_BGR2Lab); double da = 0;//色度a的平均值 double db =

库-帮我注释一下代码,谢谢了

问题描述 帮我注释一下代码,谢谢了 /** 文件库对话框 / public class FileLibDialog extends Dialog implements DialogInterface{ /* 文件库数据结构为 parentList 放 文件库名. childList 放对应文件库里的文件. 库名在parentList的位置与其文件在childList的位置一样 */ private ArrayList parentList; private ArrayList> childLis

设计-求大神帮我看一下代码哪里有问题,这是用verilog写的sdram的数据模块

问题描述 求大神帮我看一下代码哪里有问题,这是用verilog写的sdram的数据模块 `timescale 1ns / 1ps ////////////////////////////////////////////////////////////////////////////////// // Company: // Engineer: // // Create Date: 12:07:50 04/20/2016 // Design Name: // Module Name: datage

编程-能帮我修改下代码吗?那fopen_s函数的参数

问题描述 能帮我修改下代码吗?那fopen_s函数的参数 解决方案 fopen_s(&fp,"c:\zi.txt","w");

软件开发-求大神帮我看看C++代码

问题描述 求大神帮我看看C++代码 以下是我的.h头文件: #include <vector> #include<iostream> #include <iomanip> #include <math.h> #define M_PI 3.14159265359 ////////**************定义目标状态***************//////// typedef struct strTargetState//笛卡尔坐标系位置 { double

谁能帮我把这个代码补全,就差一点点了。java语法编写本地监控系统

问题描述 谁能帮我把这个代码补全,就差一点点了.java语法编写本地监控系统 package com.tz.util; import java.awt.Dimension; import java.awt.Rectangle; import java.awt.Robot; import java.awt.Toolkit; import java.awt.image.BufferedImage; import javax.swing.ImageIcon; import javax.swing.JF