RadContextMenu confirmation dialog

2 posts, 0 answers
  1. Marcel
    Marcel avatar
    48 posts
    Member since:
    Aug 2008

    Posted 02 Dec 2008 Link to this post

    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

     

     

     

     

     

     

     

     

     

  2. Yana
    Admin
    Yana avatar
    5015 posts

    Posted 05 Dec 2008 Link to this post

    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.
Back to Top