Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
20
How to cancel a menuiten.click event
posted

We are using DataMenuItem in Infragistics.Web.UI.NavigationControls for the menu.

When user click a menu item, the code first checks a condition, if the condition is not satisfied, this selected menu item will not work, and a message will pop up.  In my code I will use scriptManager.RegisterStartupScript to popup the message, and I need to cancel the menu click event.  How to do the cancelation of the menu item click?

Parents
No Data
Reply
  • 3115
    Offline posted

    In the following code when ClientEvents-ItemClick event is fired in the onClick() function we set_cancel() to true. Is that what you are looking for?

    <script type="text/javascript">

     

     

     

     

     

     

     

     

    function onClick(sender, args) {

    args.set_cancel(

     

    true);

     

     

     

    if(args.get_cancel()) {

    alert(

     

    "Canceled");

    }

    }

     

     

     

    </script>

     

     

    <ig:WebDataMenu ID="WebDataMenu1" ClientEvents-ItemClick="onClick" runat="server">

     

     

     

     

     

     

     

     

    <Items>

     

     

     

     

     

     

     

    <ig:DataMenuItem Text="Menu1">

     

     

     

    <Items>

     

     

     

    <ig:DataMenuItem Text="SubMenu1"></ig:DataMenuItem>

     

     

     

    <ig:DataMenuItem Text="SubMenu2"></ig:DataMenuItem>

     

     

     

    </Items>

     

     

     

     

     

     

    </ig:DataMenuItem >

     

     

     

     

     

     

    <ig:DataMenuItem Text="menu2"></ig:DataMenuItem >

     

     

     

     

     

    </Items>

     

     

     

     

     

    </ig:WebDataMenu >

     

     

     

     

Children