Modalpopup called from contextmenu

4 posts, 0 answers
  1. Yanling
    Yanling avatar
    15 posts
    Member since:
    Aug 2008

    Posted 08 Oct 2008 Link to this post

    Hi all,

    I use the ajaxcontroltoolkit modalpopupextender to make a ajax popup window without refreshing the page. But when the modalpopup window is called from the options in the contextmenu (no matter it is a contextmenu in treeveiw or radgrid), the page refreshes.

    Any ideas?

    Thanks.

    Hank
  2. Simon
    Admin
    Simon avatar
    2281 posts

    Posted 13 Oct 2008 Link to this post

    Hi Yanling,

    Have you handled the OnContextMenuItemClick event of the TreeView? If this is so, the Context Menu will postback the page whenever one of its Items is clicked.

    You can prevent that by handling the client-side OnContextMenuItemClicking. If you cancel the event the event (if certain conditions are met), the server-side event will not fire.

            function clientContextMenuItemClicking(sender, eventArgs) { 
                eventArgs.set_cancel(true); 
            } 

    I hope this helps.

    Greetings,
    Simon
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
  3. Yanling
    Yanling avatar
    15 posts
    Member since:
    Aug 2008

    Posted 27 Oct 2008 Link to this post

    Hi Simon,

    If I use eventArgs.set_cancel(true), the server code will not run. Then the modal popup will not show.

    regards
    Hank
  4. Simon
    Admin
    Simon avatar
    2281 posts

    Posted 29 Oct 2008 Link to this post

    Hi Yanling,

    In this case, use call the show() client side method of the ModalPopupExtender to show it manually after canceling the OnContextMenuItemClicking event.

    Regards,
    Simon
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Back to Top