Cancel Menu Postback Clientside

4 posts, 0 answers
  1. Robert Verderber
    Robert Verderber avatar
    33 posts
    Member since:
    Aug 2005

    Posted 02 Apr 2008 Link to this post

    Is there a way to cancel the click on a menu item in the OnClientItemClicked event?

    The documentation says you can by returning a false from the handler but I can seem to get it to work.

    Here is a routine i wrote to cancel the postback if the user hits the cancel button on the confirm window 

    function RADItemClicked(sender, eventArgs)
        var item = eventArgs.get_item();
        if(item.get_text()=="Save Changes") {
            if (!confirm("Save Changes?")) { return false }

    Not sure what im doing wrong. Any advise would be appreciated.

  2. Veselin Vasilev
    Veselin Vasilev avatar
    2992 posts

    Posted 03 Apr 2008 Link to this post

    Hello Robert Verderber,

    I suggest that you subscribe to the OnClientItemClicking event. In its event handler you can check the text of the clicked item and use set_cancel(true) to cancel the event.

    Here is how your event handler can be defined:

    function onClientItemClicking(sender, eventArgs)  
        var item = eventArgs.get_item();  
        if(item.get_text()== "Save Changes") {  
            if (!confirm("Save Changes?")) { eventArgs.set_cancel(true); }  

    <telerik:RadMenu ID="RadMenu1"   

    I hope this helps.

    Kind regards,
    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center
  3. DevCraft R3 2016 release webinar banner
  4. Michael Dosen
    Michael Dosen avatar
    4 posts
    Member since:
    Jul 2005

    Posted 16 Dec 2010 Link to this post

    why return false did not work! I have it working with your fix.
  5. Helen
    Helen avatar
    1052 posts

    Posted 17 Dec 2010 Link to this post


    It works for the classic RadMenu version.

    Kind regards,
    the Telerik team
    Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
Back to Top