views:

298

answers:

0

Hi,

I have been trying to get the Context menus running at some of the sites on the web like http://www.abeautifulsite.net and so forth but every time my menu divs show on the page and right click doesn't work. Is there an example mvc hopefully or a .net project I can download to see how it is working?

Here is what I have in a View of a MVC application. Just added on top of the main page: Nevermind. I would of put it if I didn't get blocked for putting webpage code in my description. Is there a " " or something to allow links?

ok, trying again

<%@ Page Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage" %>

<asp:Content ID="indexTitle" ContentPlaceHolderID="TitleContent" runat="server">
    Home Page
    <link href="../../Content/jquery.contextMenu.css" rel="stylesheet" type="text/css" />
    <script src="../../Scripts/jquery-1.3.2.min.js" type="text/javascript"></script>
    <script src="../../Scripts/jquery.contextMenu.js" type="text/javascript"></script>

script lang and type

            $(document).ready(function() {
                $("#DivRight").contextMenu({
                    menu: 'myMenu'
                }, function(action, el, pos) {
                    alert(
'Action: ' + action + '\n\n' +
'Element text: ' + $(el).text() + '\n\n' +
'GUID: ' + getGUID($(el).attr("href")) + '\n\n' +
'X: ' + pos.x + ' Y: ' + pos.y + ' (relative to element)\n\n' +
'X: ' + pos.docX + ' Y: ' + pos.docY + ' (relative to document)'
);
                });
            });

            function getGUID(mystr) {
                var reGUID = /\w{8}[-]\w{4}[-]\w{4}[-]\w{4}[-]\w{12}/g
                var retArr = [];
                var retval = '';
                retArr = mystr.match(reGUID);
                if (retArr != null) {
                    retval = retArr[retArr.length - 1];
                }
                return retval;
            }

            $(document).ready(function() {
                $(Obj).showMenu({
                    opacity: 0.8,
                    query: "#myMenu2",
                    zindex: 2000
                });
                $("DivRight").showMenu({
                    opacity: 0.8,
                    query: "#myMenu"
                });

                $("p").showMenu({
                    opacity: 0.8,
                    query: "#myMenu2"
                });
            });

<ul id="Ul1" class="contextMenu">
    <li class="copy"><a href="#add">Add</a></li>
    <li class="edit"><a href="#edit">Edit</a></li> 
    <li class="delete"><a href="#delete">Delete</a></li>
    <li class="quit separator"><a href="#cancel">Cancel</a></li>
 </ul>
    <div id="DivLeft">

    </div>
    <div id="DivRight">
    <table><thead> test</thead><tr>1</tr><tr>2</tr><tr>3</tr></table>
    </div>

    <span>Right Click me</span>
    <p>You can right Click me too </p>
        <div id="myMenu">
        <ul>
            <li><a href="#">Edit</a></li>
            <li><a href="#">Create</a></li>
            <li><a href="#">Book</a></li>
        </ul>
    </div>
    <div id="myMenu2">
        <ul>
            <li><a href="#">Create</a></li>
            <li><a href="#">Delete</a></li>
            <li><a href="#">Job</a></li>
        </ul>
    </div>

Thanks