Click here to Skip to main content
13,902,007 members
Rate this:
 
Please Sign up or sign in to vote.
See more:
Hi,

I have seen the code posted by you for the context menu to a tree view asp .net. I need the code with the same functionality in Javascript.
Could you please help me...

and when i save the below code in a notepad with .html ext and try to open as a webpage its just displaying the context menu and not the tree. Do i need to save in other format other than .html? Do i need to insatall .net in my system o run this code?

Please reply to the above questions.....


<br />
<br />
<html><br />
<head runat="server"><br />
    <title>xTreeView</title><br />
    <style type="text/css"><br />
<!--<br />
<br />
.skin0{<br />
position:absolute;<br />
width:140px;<br />
border:2px solid black;<br />
background-color:menu;<br />
font-family:Verdana;<br />
line-height:20px;<br />
cursor:default;<br />
font-size:14px;<br />
z-index:100;<br />
visibility:hidden;<br />
}<br />
<br />
.menuitems{<br />
padding-left:10px;<br />
padding-right:10px;<br />
font-family:Verdana;<br />
font-size:12px;<br />
color:black;<br />
}<br />
--><br />
</style><br />
<br />
</head><br />
<body><br />
<br />
<br />
    <form id="form1" runat="server"><br />
       <asp:panel id="Panel1" runat="server" height="50px" width="176px" xmlns:asp="#unknown"><br />
          <br />
                <asp:treeview id="TreeView1" runat="server" backcolor="#FFFFC0" height="180px" width="172px"><br />
                <nodes><br />
                    <asp:treenode text="Root" value="sroot"><br />
                        <asp:treenode text="Parent 1" value="sParent 1"><br />
                            <asp:treenode text="<b id='b1' oncontextmenu="return showmenuie5(event)" > this is a test</b>" value="sLeaf 1"></asp:treenode><br />
                            <asp:treenode text="Leaf 2" value="sLeaf 2"></asp:treenode><br />
                        </asp:treenode><br />
                        <asp:treenode text="Parent 2" value="sParent 2"><br />
                            <asp:treenode text="Leaf 1" value="sLeaf 1"></asp:treenode><br />
                            <asp:treenode text="Leaf 2" value="sLeaf 2"></asp:treenode><br />
                        </asp:treenode><br />
                    </asp:treenode><br />
                </nodes><br />
            </asp:treeview><br />
        </asp:panel><br />
        <div><br />
               <br />
         <br />
                 <br />
         <br />
            <br />
            <asp:panel id="Panel2" runat="server" display:none="" bordercolor="Black" cssclass="skin0" onmouseover="highlightie5(event)" onmouseout="lowlightie5(event)" onclick="jumptoie5(event)" xmlns:display="#unknown" xmlns:asp="#unknown"><br />
                <div class="menuitems"><asp:linkbutton id="LinkButton1" runat="server" cssclass="menuitems">New Node</asp:linkbutton></div><br />
                <div class="menuitems"><asp:linkbutton id="LinkButton2" runat="server" cssclass="menuitems">Edit Node</asp:linkbutton></div><br />
                <hr /><br />
                <div class="menuitems"><asp:linkbutton id="LinkButton3" runat="server" cssclass="menuitems">Delete Node</asp:linkbutton></div><br />
                <hr /><br />
                <div class="menuitems"><asp:linkbutton id="LinkButton4" runat="server" cssclass="menuitems">FAQS</asp:linkbutton></div><br />
                <div class="menuitems"><asp:linkbutton id="LinkButton5" runat="server" cssclass="menuitems">Online Help</asp:linkbutton></div><br />
                <hr /><br />
                <div class="menuitems"><asp:linkbutton id="LinkButton6" runat="server" cssclass="menuitems">Email Me</asp:linkbutton></div><br />
            </asp:panel><br />
            <br /><br />
            <a href=""> </a><br />
         </div><br />
    </form><br />
    <br />
    <br />
 <script src="xtreeview.js" type="text/javascript"></script><br />
 <br />
  <br />
</body><br />
</html><br />
<br />
Posted
Updated 15-Jun-10 18:15pm
v2
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 1

Saving this file in html will not work as some of the controls used in this example are server side control like linkbutton. You need to make a website and add a aspx page to it, copy this code and don't forgot to add the "xtreeview.js" file in the same folder where your aspx page exists.
   
Comments
SwathiSambaraj 16-Jun-10 0:37am
   
Thank You Prakash!
My understanding is, i need to save the xtreeview.js file and the above code in .aspx extention in a common folder? but i need some file in .html in order to view the o/p as a webpage rite? Iam starter in asp.NET and i never ran any file using asp.NET. Actually i need CONTEXT MENU TO THE TREE VIEW using Javascript.. but meanwhile i found the same functionality in asp.NET so tried to ran the file to view the output..
could you please explain more clearly how to run it..
Thanks in advance.

Awaiting your response,
Swathi
PSK_ 16-Jun-10 0:56am
   
If you want some static pages without any server side code and controls in that case you can go for a HTML page. In this type of page you can only use client side scripting using javascript and for display you need to use the standard html controls.
In case you are using some server side control like treeview & linkbutton(what you are using) you need to have a aspx page and you need a webserver to run the page. In visual studio there is a inbuilt web-server you just need to create a website add your aspx page, copy the markup, copy the js file in the same folder where your aspx page exist and hit the F5 button or run icon.
For more details you can search on google or Code Project for this.
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 2

Thank You Prakash!
My understanding is, i need to save the xtreeview.js file and the above code in .aspx extention in a common folder., but i need some file in .html in order to view the o/p as a webpage rite? Iam starter in asp.NET and i never ran any file using asp.NET. Actually i need CONTEXT MENU TO THE TREE VIEW using Javascript.. but meanwhile i found the same functionality in asp.NET so tried to ran the file to view the output..
could you please explain more clearly how to run it..
Thanks in advance.

Awaiting your response,
Swathi
   
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


Advertise | Privacy | Cookies | Terms of Service
Web06 | 2.8.190306.1 | Last Updated 16 Jun 2010
Copyright © CodeProject, 1999-2019
All Rights Reserved.
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100