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
Re: Need help in treeview
I'm guessing that AIS4U's code is for the WinForms TreeView, not the WebForms version.
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