This is a migrated thread and some comments may be shown as answers.

RadContextMenu confirmation dialog

1 Answer 100 Views
Menu
This is a migrated thread and some comments may be shown as answers.
Marcel
Top achievements
Rank 1
Marcel asked on 02 Dec 2008, 10:13 PM
How can I add a confirmation dialog to the context menu for the delete menu item? I have tried the 'OnClientItemClicking' property (see below), but get runtime error: 'OnClientItemClicking' property cannot be set declaratively.

 

 

<script type="text/javascript">

 function onClicking(sender, eventArgs)
 {
    var item = eventArgs.get_item();
    var proceed = confirm("Permanently delete this Date and ALL samples under it?");

    if (!proceed)
    {
        eventArgs.set_cancel(true);
    }
 }

</script>
 

<telerik:RadTreeViewContextMenu runat="server" ID="ChemicalDateMenu" ClickToOpen="True" Skin="Vista" OnClientItemClicking="onClicking">
 <Items>
  <telerik:RadMenuItem Text="Add New Sample" Value="ChemicalAdd" runat="server"></telerik:RadMenuItem>
  <telerik:RadMenuItem Text="Delete Sample" Value="ChemicalDelete" runat="server"></telerik:RadMenuItem>
 </Items>
 <CollapseAnimation Duration="200" Type="OutQuint" />
</telerik:RadTreeViewContextMenu>

Thx Marcel

 

 

 

 

 

 

 

 

 

1 Answer, 1 is accepted

Sort by
0
Yana
Telerik team
answered on 05 Dec 2008, 01:55 PM
Hi Macrel,

You're using context menu of the RadTreeView, so you should subscribe to OnClientContextMenuItemClicking event of the treeview. You can find the clicked item in its handler like this:

function onClicking(sender, eventArgs)
{
var item = eventArgs.get_menuItem();
. . .
}

Hope this helps.

Best wishes,
Yana
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Tags
Menu
Asked by
Marcel
Top achievements
Rank 1
Answers by
Yana
Telerik team
Share this question
or