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
126
Problem with the client ItemClick in the WebDataMenu when set_cancel is true
posted


Hello, I've a problem with the cancel event in the WebDataMenu.
I've a WebDataMenu as a context menu in a WebDataTree. In some of the menu items I want to make actions in client. In other items I want to execute the server handler.
With the server action there is no problem, but if I cancel the postback once, the client handler doesn't work for this item any more.

You can try this sample:

The first time I click in the first item I see the message, but if I click again it doesn't work, if I click in the second item there is no problem.

            <ig:WebDataMenu runat="server" ID="WebDataMenu1" IsContextMenu="true" Style="display: none;"
                OnItemSelected="WebDataMenu1_ItemSelected">
                <AutoPostBackFlags ItemClick="Off" ItemSelected="On" />
                <ClientEvents ItemSelected="WebDataMenu1Client_ItemClick" />
                <GroupSettings AnimationType="ExpandAnimation" Orientation="Vertical" />
                <Items>
                    <ig:DataMenuItem Text="No Postback" Key="Np">
                    </ig:DataMenuItem>
                    <ig:DataMenuItem Text="Postback" Key="Yp">
                    </ig:DataMenuItem>
                </Items>
            </ig:WebDataMenu>

function WebDataMenu1Client_ItemClick(sender, e) {
        var itemMenu = e.getItem();
        switch (itemMenu.get_key()) {
            case "Np":
                {
                    alert("No Postback");
                    e.set_cancel(true);
                    break;
                }
            case "Yp":
                {
                    alert("Yes, Postback!");
                    e.set_cancel(false);
                    break;
                }
        }
}

 

Parents Reply Children
No Data