| Author: satheesh 30 Nov 2008 | Member Level: Silver | Rating:  Points: 6 |
<asp:TreeView ID="TreeView1" runat="server" BackColor="#FFFFC0" Height="180px" Width="172px"> <Nodes> <asp:TreeNode Text="Root" Value="sroot"> <asp:TreeNode Text="Parent 1" Value="sParent 1"> <asp:TreeNode Text="this is a test" Value="sLeaf 1" > </asp:TreeNode> <asp:TreeNode Text="Leaf 2" Value="sLeaf2"> </asp:TreeNode> </asp:TreeNode> <asp:TreeNode Text="Parent 2" Value="sParent2"> <asp:TreeNode Text="Leaf 1" Value="sLeaf 1"> </asp:TreeNode> <asp:TreeNode Text="Leaf 2" Value="sLeaf 2"> </asp:TreeNode> </asp:TreeNode> </asp:TreeNode> </Nodes> </asp:TreeView>
hello use this code to create tree view in asp.net
|
| Author: satheesh 30 Nov 2008 | Member Level: Silver | Rating:  Points: 6 |
<script language="javascript"> var ie5=document.all&&document.getElementById var ns6=document.getElementById&&!document.all if (ie5||ns6) var menuobj=document.getElementById("Panel2")
function showmenuie5(e){ //Find out how close the mouse is to the corner of the window var rightedge=ie5? document.body.clientWidth-event.clientX : window.innerWidth-e.clientX var bottomedge=ie5? document.body.clientHeight-event.clientY : window.innerHeight-e.clientY //if the horizontal distance isn't enough to accomodate the width of //the context menu
if (rightedge<menuobj.offsetWidth) //move the horizontal position of the menu to the left by it's width menuobj.style.left=ie5? document.body.scrollLeft+event.clientX-menuobj.offsetWidth : window.pageXOffset+e.clientX-menuobj.offsetWidth else //position the horizontal position of the menu where the mouse was //clicked
menuobj.style.left=ie5? document.body.scrollLeft+event.clientX : window.pageXOffset+e.clientX //same concept with the vertical position if (bottomedge<menuobj.offsetHeight) menuobj.style.top=ie5? document.body.scrollTop+event.clientY-menuobj.offsetHeight : window.pageYOffset+e.clientY-menuobj.offsetHeight else menuobj.style.top=ie5? document.body.scrollTop+event.clientY : window.pageYOffset+e.clientY if(ie5) window.event.cancelBubble = true; else if(ns6) e.stopPropagation(); menuobj.style.visibility="visible" return false } </script>
|