RadContextMenu Cancel Postback from OnContextMenuClick javascript event

2 posts, 1 answers
  1. Tuhin Ghosh
    Tuhin Ghosh avatar
    8 posts
    Member since:
    May 2010

    Posted 19 Jul 2011 Link to this post


    I have created following context menu:

    <telerik:RadContextMenu OnClientShowing="OnContextMenuShowing" OnClientItemClicked="OnContextMenuClick"
                      ID="RadMenu1" runat="server" OnItemClick="RadMenu1_ItemClick" EnableRoundedCorners="true"
                        <telerik:RadMenuItem Text="Copy" />
                        <telerik:RadMenuItem Text="Cut" />
                        <telerik:RadMenuItem Text="Paste Above" />
                        <telerik:RadMenuItem Text="Paste Below" />

    OnContextMenuClick I am writing some validation and I want to cancel the postback if validations fails, but its not happening.

    I have searched everywhere but did not find any suitable answers for this , many places I found the following statement but it is not working 


    args in OnContextMenuClick does not have set_cancel method.

    Also tried with return false; that too not worked.

    Please help me by providing solutions its urgent.

    Thanks & Regards
  2. Answer
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 19 Jul 2011 Link to this post

    Hello Tuhin,

    You cannot cancel the OnClientItemClicked event so try the same in OnClientItemClicking and cancel the event.
    <script type="text/javascript">
        function OnClientItemClicking(sender, args)
            var item = args.get_item();
            if (item.get_text() == "Cut")

Back to Top