Submenus Not Expanding

5 posts, 1 answers
  1. Aron
    Aron avatar
    24 posts
    Member since:
    Sep 2011

    Posted 28 Oct 2012 Link to this post

    Menu items #1 "Admin Home" and #5 "Help" work fine, but #2, 3 & 4 with submenus are not expanding.

    @(Html.Kendo().Menu()
    .Name("AdminMenu")
    .OpenOnClick(true)
    .Items(items =>
    {
        items.Add().Text("Admin Home")
              .ImageUrl(Url.Content("~/Content/icons/baseball.png"))
              .HtmlAttributes(new { style = "width:170px" })
              .ImageUrl("~/Content/Icons/ajax.png")
              .Action("Index", "Admin");
     
        items.Add().Text("Manage")
             .ImageUrl(Url.Content("~/Content/icons/golf.png"))
             .HtmlAttributes(new { style = "width:170px" })
             .Items(children =>
             {
                 children.Add().Text("Donors").ImageUrl("~/Content/Icons/rep.png").Action("ManageDonors", "Admin");
                 children.Add().Text("Recipients").ImageUrl("~/Content/Icons/sitefinity.png").Action("ManageRecipients", "Admin");
                 children.Add().Text("Friends").ImageUrl("~/Content/Icons/test.png").Action("ManageFriends", "Admin");
                 children.Add().Text("Admin Guys").ImageUrl("~/Content/Icons/win.png").Action("ManageAdmin", "Admin");
                 children.Add().Text("Password Reset").ImageUrl("~/Content/Icons/wpf.png").Action("PasswordReset", "Admin");
             });
     
        items.Add().Text("Marketing")
             .ImageUrl(Url.Content("~/Content/icons/golf.png"))
             .HtmlAttributes(new { style = "width:170px" })
             .Items(children =>
             {
                 children.Add().Text("Email").ImageUrl("~/Content/Icons/rep.png").Action("ManageFriends", "Admin");
                 children.Add().Text("Newsletter").ImageUrl("~/Content/Icons/sitefinity.png").Action("Newsletter", "Admin");
                 children.Add().Text("Announcements").ImageUrl("~/Content/Icons/test.png").Action("Announcements", "Admin");
                 children.Add().Text("New Members").ImageUrl("~/Content/Icons/win.png").Action("NewMembers", "Admin");
                 children.Add().Text("Current Web Site").Url("http://www.life-renewal.org");
             });
     
        items.Add().Text("My Mail")
             .ImageUrl(Url.Content("~/Content/icons/golf.png"))
             .HtmlAttributes(new { style = "width:170px" })
             .Items(children =>
             {
                 children.Add().Text("Email").ImageUrl("~/Content/Icons/rep.png").Action("MyMail", "Admin");
                 children.Add().Text("Tasks").ImageUrl("~/Content/Icons/sitefinity.png").Action("MyTasks", "Admin");
                 children.Add().Text("Calendar").ImageUrl("~/Content/Icons/test.png").Action("MyCalendar", "Admin");
     
             });
     
        items.Add().Text("Help")
              .Action("Help", "Admin")
              .HtmlAttributes(new { style = "width:170px" })
              .ImageUrl("~/Content/Icons/wpf.png");
     
    }))
  2. Dimo
    Admin
    Dimo avatar
    8333 posts

    Posted 30 Oct 2012 Link to this post

    Hi Aron,

    Your Menu declaration works correctly on my side. Please don't forget you have set .OpenOnClick(true)

    Regards,
    Dimo
    the Telerik team
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
  3. UI for ASP.NET MVC is VS 2017 Ready
  4. Aron
    Aron avatar
    24 posts
    Member since:
    Sep 2011

    Posted 30 Oct 2012 Link to this post

    Thanks for responding.  I changed the parameter to false, but it is still not working.  Here is the entire page:

    <!DOCTYPE html>
     
    <html>
    <head>
        <meta name="viewport" content="width=device-width" />
            <meta charset="utf-8" />
        <title>@ViewBag.Title</title>
            <link href="~/favicon.ico" rel="shortcut icon" type="image/x-icon" />
            <meta name="viewport" content="width=device-width" />
            @Styles.Render("~/Content/css")
            @Scripts.Render("~/bundles/modernizr")
            <link href="@Url.Content("~/Content/kendo/2012.2.913/kendo.common.min.css")" rel="stylesheet" type="text/css" />
        <link href="@Url.Content("~/Content/kendo/2012.2.913/kendo.dataviz.min.css")" rel="stylesheet" type="text/css" />
        <link href="@Url.Content("~/Content/kendo/2012.2.913/kendo.metro.min.css")" rel="stylesheet" type="text/css" />
        <script src="@Url.Content("~/Scripts/kendo/2012.2.913/jquery.min.js")"></script>
        <script src="@Url.Content("~/Scripts/kendo/2012.2.913/kendo.all.min.js")"></script>
        <script src="@Url.Content("~/Scripts/kendo/2012.2.913/kendo.aspnetmvc.min.js")"></script>
     
    </head>
        <body>
            <header>
                <div class="content-wrapper">
                    <div class="float-left">
                        <p class="site-title">
                            <a href='@Url.Action("Index", "Home")'>
                            <img src='@Url.Content("~/Images/renewal_logo.gif")' /></a>
                    </div>
                    <div class="float-right">
                        <section id="login">
                            @Html.Partial("_LoginPartial")
                        </section>
                        <nav>
              @(Html.Kendo().Menu()
              .Name("AdminMenu")
              .OpenOnClick(false)
              .HighlightPath(true)
              .Animation(true)
              .Items(items =>
              {
                  items.Add().Text("Admin Home")
                        .ImageUrl("~/Content/Icons/ajax.png")
                        .HtmlAttributes(new { style = "width:170px" })
                        .Action("Index", "Admin");
     
                  items.Add().Text("Manage")
                       .ImageUrl(Url.Content("~/Content/icons/mvc.png"))
                       .HtmlAttributes(new { style = "width:170px" })
                       .Items(children =>
                       {
                           children.Add().Text("Donors").ImageUrl("~/Content/Icons/rep.png").Action("ManageDonors", "Admin");
                           children.Add().Text("Recipients").ImageUrl("~/Content/Icons/sitefinity.png").Action("ManageRecipients", "Admin");
                           children.Add().Text("Friends").ImageUrl("~/Content/Icons/test.png").Action("ManageFriends", "Admin");
                           children.Add().Text("Admin Guys").ImageUrl("~/Content/Icons/win.png").Action("ManageAdmin", "Admin");
                           children.Add().Text("Password Reset").ImageUrl("~/Content/Icons/wpf.png").Action("PasswordReset", "Admin");
                       });
     
                  items.Add().Text("Marketing")
                       .ImageUrl(Url.Content("~/Content/icons/sitefinity.png"))
                       .HtmlAttributes(new { style = "width:170px" })
                       .Items(children =>
                       {
                           children.Add().Text("Email").ImageUrl("~/Content/Icons/rep.png").Action("ManageFriends", "Admin");
                           children.Add().Text("Newsletter").ImageUrl("~/Content/Icons/sitefinity.png").Action("Newsletter", "Admin");
                           children.Add().Text("Announcements").ImageUrl("~/Content/Icons/test.png").Action("Announcements", "Admin");
                           children.Add().Text("New Members").ImageUrl("~/Content/Icons/win.png").Action("NewMembers", "Admin");
                           children.Add().Text("Current Web Site").Url("http://www.life-renewal.org");
                       });
     
                  items.Add().Text("My Mail")
                       .ImageUrl(Url.Content("~/Content/icons/win.png"))
                       .HtmlAttributes(new { style = "width:170px" })
                       .Items(children =>
                       {
                           children.Add().Text("Email").ImageUrl("~/Content/Icons/rep.png").Action("MyMail", "Admin");
                           children.Add().Text("Tasks").ImageUrl("~/Content/Icons/sitefinity.png").Action("MyTasks", "Admin");
                           children.Add().Text("Calendar").ImageUrl("~/Content/Icons/test.png").Action("MyCalendar", "Admin");
     
                       });
     
                  items.Add().Text("Help")
                        .Action("Help", "Admin")
                        .HtmlAttributes(new { style = "width:170px" })
                        .ImageUrl("~/Content/Icons/wpf.png");
     
              }))
                        </nav>
                        <div>@(Html.Kendo().DatePicker().Name("Birthday"))</div>
                    </div>
                </div>
            </header>
            <div id="body">
                @RenderSection("featured", required: false)
                <section class="content-wrapper main-content clear-fix">
                    @RenderBody()
                </section>
            </div>
            <footer>
                <div class="content-wrapper">
                    <div class="float-left">
                        <p>© @DateTime.Now.Year - Renewal Admin Application</p>
                    </div>
                </div>
            </footer>
     
            @Scripts.Render("~/bundles/jquery")
            @RenderSection("scripts", required: false)
        </body>
    </html>
  5. Answer
    Dimo
    Admin
    Dimo avatar
    8333 posts

    Posted 31 Oct 2012 Link to this post

    Hi Aron,

    It looks like you are registering two jQuery instances on the page, which deletes all previously registered jQuery plugins, such as the Kendo UI widgets.

    Also make sure there are no JS errors on the page.

    Greetings,
    Dimo
    the Telerik team
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
  6. Aron
    Aron avatar
    24 posts
    Member since:
    Sep 2011

    Posted 31 Oct 2012 Link to this post

    Thanks for responding.  I removed the 2nd instance and that did it.  Of interest, I did not add either jQuery instance. The first was inserted by Kendo "Configure Project" and the 2nd by VS. 
Back to Top
UI for ASP.NET MVC is VS 2017 Ready