I have a RadTreeView on the click the nodes get selected and then at the right click a context menu is shown. This is working fine but the problem is to a context menu for a node I have to first select it and then right click on it. Is there a way by which directly on the right click the node will be selected and the context menu will appear for it.
3 Answers, 1 is accepted
0
Hi,
You can handle OnClientContextMenuShowing:
Regards,
Peter
the Telerik team
You can handle OnClientContextMenuShowing:
<script type=
"text/javascript"
>
function
OnClientContextMenuShowing(sender, args) {
alert(1);
}
</script>
<telerik:RadTreeView ID=
"RadTreeView1"
runat=
"server"
OnClientContextMenuShowing=
"OnClientContextMenuShowing"
>
<Nodes>
<telerik:RadTreeNode runat=
"server"
Text=
"Root RadTreeNode1"
>
<Nodes>
<telerik:RadTreeNode runat=
"server"
Text=
"Child RadTreeNode 1"
>
</telerik:RadTreeNode>
<telerik:RadTreeNode runat=
"server"
Text=
"Child RadTreeNode 2"
>
</telerik:RadTreeNode>
</Nodes>
</telerik:RadTreeNode>
<telerik:RadTreeNode runat=
"server"
Text=
"Root RadTreeNode2"
>
</telerik:RadTreeNode>
</Nodes>
</telerik:RadTreeView>
Regards,
Peter
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
0

Onkar
Top achievements
Rank 1
answered on 25 Jul 2012, 08:13 PM
Hi Peter,
Thanks for your reply. I tried using the OnClientContextMenuShowing but the problem is I need to make a call to a server side function. I have a function which handles the OnNodeClick event I need to call the same function when the right click is done. I tried using the client side method and from there trying to invoke the server side method but that was not possible. Could you suggest me a way how that can be accomplished.
Thanks for your reply. I tried using the OnClientContextMenuShowing but the problem is I need to make a call to a server side function. I have a function which handles the OnNodeClick event I need to call the same function when the right click is done. I tried using the client side method and from there trying to invoke the server side method but that was not possible. Could you suggest me a way how that can be accomplished.
0
Accepted
Hi Onkar,
Please, try the following:
Kind regards,
Peter
the Telerik team
Please, try the following:
<script type=
"text/javascript"
>
function
OnClientContextMenuShowing(sender, args) {
args.get_node().select();
$telerik.cancelRawEvent(args.get_domEvent());
}
</script>
<telerik:RadTreeView ID=
"RadTreeView1"
runat=
"server"
OnClientContextMenuShowing=
"OnClientContextMenuShowing"
OnNodeClick=
"RadTreeView1_NodeClick"
>
<Nodes>
<telerik:RadTreeNode runat=
"server"
Text=
"Root RadTreeNode1"
>
<Nodes>
<telerik:RadTreeNode runat=
"server"
Text=
"Child RadTreeNode 1"
>
</telerik:RadTreeNode>
<telerik:RadTreeNode runat=
"server"
Text=
"Child RadTreeNode 2"
>
</telerik:RadTreeNode>
</Nodes>
</telerik:RadTreeNode>
<telerik:RadTreeNode runat=
"server"
Text=
"Root RadTreeNode2"
>
</telerik:RadTreeNode>
</Nodes>
</telerik:RadTreeView>
protected
void
RadTreeView1_NodeClick(
object
sender, RadTreeNodeEventArgs e)
{
Response.Write(e.Node.Text);
}
Kind regards,
Peter
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.