C# Tutorials and offshore development in India
    Tutorials   Resources   Forum   Reviews   Communities   Interview   Jobs   Projects   Training   Your Ad Here    
Silverlight Games | Mentor | Code Converter | Articles | Code Factory | Computer Jokes | Members | Peer Appraisal | IT Companies | Bookmarks | Polls | Revenue Sharing | Lobby | Gift Shop |


Prizes & Awards
My Profile



Active Members
TodayLast 7 Days more...






Forums » .NET » JavaScript »

How create Treeview Node Rightclick Context Menu in Javascript


Posted Date: 11 Nov 2008      Posted By: valli      Member Level: Silver     Points: 1   Responses: 2



Pls Urgent!!!!!!!!!!!
How create Treeview Node Rightclick Context Menu in Javascript in Dynamically.....





Responses

Author: satheesh    30 Nov 2008Member Level: SilverRating: 2 out of 52 out of 5     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 2008Member Level: SilverRating: 2 out of 52 out of 5     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>



Post Reply

 This thread is locked for new responses. Please post your comments and questions as a separate thread.
If required, refer to the URL of this page in your new post.


Next : give me a suggestion......
Previous : Delete key doesn't work for textbox keypress event
Return to Discussion Forum
Post New Message
Category: JavaScript

Related Messages



dotNet Slackers

About Us    Contact Us    Privacy Policy    Terms Of Use