Results 1 to 4 of 4

Thread: Need help in treeview

  1. #1

    Thread Starter
    New Member
    Join Date
    Jan 2007
    Posts
    14

    Need help in treeview

    Hello there......

    I am using ASP.NET and C#.NET and want to perform action on right clicking on a node in treeview.I dont know even the event or property which might help me in perfoming this.How to perform action on right click?
    I have searched a lot.....but i got the articals that tells about windows form and i want that in WEB FORM.
    Please help me to solve this.

    Thank you in Advance

    Jigs

  2. #2
    Frenzied Member
    Join Date
    Aug 2005
    Posts
    1,042

    Re: Need help in treeview

    Jigna:

    I am not sure if this is what you are looking for or not.

    The following example displays the ContextMenu assigned to
    a TreeView when the right mouse button is clicked and released.

    This code assumes you have a Form with a TreeView on it. It
    is also assumed that the TreeView has a ContextMenu assigned
    to its ContextMenu property.

    [C#]
    Code:
     
    private void treeView1_MouseUp(object sender, MouseEventArgs e)
    {
       // If the right mouse button was clicked and released,
       // display the context menu assigned to the TreeView. 
       if(e.Button == MouseButtons.Right)
       {
          treeView1.ContextMenu.Show(treeView1, new Point(e.X, e.Y) );      
       }
    }
    Also, I am not 100% certain, but I think that the mouse pointer must be over a child node and not a parent node.

    Good Luck

  3. #3
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: Need help in treeview

    I'm guessing that AIS4U's code is for the WinForms TreeView, not the WebForms version.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  4. #4
    Frenzied Member
    Join Date
    Aug 2005
    Posts
    1,042

    Re: Need help in treeview

    Yup, you are right.

    didn't notice the Web forms part of the request.

    sorry about that.

    You can find the Web Forms TreeView Code here:
    http://www.codeproject.com/aspnet/ExtendedTreeView.asp
    Last edited by AIS4U; Feb 10th, 2007 at 09:25 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width