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
739
How do I make a context menu with items that go to a URL?
posted

This must be some basic oversight by me.  All I want is a context menu with a single item that, when clicked, goes to a URL in a new window.  I am able to navigate by double-clicking the item, but not single-clicking.  My code is like this:

        <ig:WebDataMenu ID="mnuPopup" runat="server" IsContextMenu="True">
            <Items>
                <ig:DataMenuItem NavigateUrl="http://www.google.com"
                    Text="Test Item" Target="_blank">
                </ig:DataMenuItem>
            </Items>
        </ig:WebDataMenu>

and in the page I have this:

    <div id="divTickets" runat="server" oncontextmenu="return false;" onmousedown="showPopup();">

and this:

        function showPopup() {

            var menu = $find("<%= mnuPopup.ClientID %>");
            var evt = window.event;

            if (menu != null && evt != null && evt.button == 2) {
                menu.showAt(null, null, evt);
            }

        }

 

Do I have to write my own code to find the item and get its URL, then window.open?  Seems like a single click should be the default behavior for activating items.

Thanks.