I have a radTreeView like this.
This is the ContextMenuClicking javascript in client side.
finally this is the server side code for onNodeEdit
<
telerik:RadAjaxPanel
ID
=
"RadAjaxPanel1"
runat
=
"server"
LoadingPanelID
=
"RadAjaxLoadingPanel1"
>
<
telerik:RadTreeView
ID
=
"RadTreeView1"
CheckBoxes
=
"true"
Runat
=
"server"
OnContextMenuItemClick
=
"menuClicked"
OnClientContextMenuItemClicking
=
"clientMenuClicking"
OnNodeEdit
=
"RadTreeView1_NodeEdit"
>
<
ContextMenus
>
<
telerik:RadTreeViewContextMenu
ID
=
"ctxMenuAdd"
runat
=
"server"
>
<
Items
>
<
telerik:RadMenuItem
Value
=
"addNode"
Text
=
"Add Node"
>
</
telerik:RadMenuItem
>
<
telerik:RadMenuItem
Value
=
"delNode"
Text
=
"Delete Node"
>
</
telerik:RadMenuItem
>
<
telerik:RadMenuItem
Value
=
"renNode"
Text
=
"Rename Node"
>
</
telerik:RadMenuItem
>
</
Items
>
</
telerik:RadTreeViewContextMenu
>
</
ContextMenus
>
</
telerik:RadTreeView
>
</
telerik:RadAjaxPanel
>
This is the ContextMenuClicking javascript in client side.
function clientMenuClicking(sender, args)
{
var menuItem = args.get_menuItem();
var treeNode = args.get_node();
menuItem.get_menu().hide();
switch (menuItem.get_value())
{
case "addNode":
var windowResult = window.showModalDialog("newNode.html", "Enter Value", "dialogHeight: 300px; dialogWidth: 300px;");
document.getElementById("HiddenField1").value = windowResult;
break;
case "renNode":
treeNode.startEdit();
break;
}
}
finally this is the server side code for onNodeEdit
protected void RadTreeView1_NodeEdit(object sender, RadTreeNodeEditEventArgs e)
{
e.Node.Text = e.Text;
}
The problem is, when I right click on the node and select "Rename" the node turns into a text box only for a split second, then it goes back to normal mode.
It seems when I click the rename option, the client side code is firing and the node is turning into a text box. but then somehow a page postback is occurring which is removing the textbox.
How can I get rid of the issue?