This is a migrated thread and some comments may be shown as answers.

menu control inactive

1 Answer 57 Views
Menu
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
neal
Top achievements
Rank 1
neal asked on 04 Apr 2012, 10:37 AM
Hi
I have started a new telerik mvc project in visula studio and added a menu control in a view.  I also have a menu control in the master page.

The code for the master page is the standard one that comes with a new telerik project

    <div class="page">
        <header>
            <div id="title">
                <h1>My MVC Application</h1>
            </div>

            @(Html.Telerik().Menu()
                    .Name("menu")
                    .Items(menu => {
                        menu.Add().Text("Home").Action("Index", "Home");
                        menu.Add().Text("About").Action("About", "Home");
                    }))
        </header>
        <section id="main">
            @RenderBody()
        </section>
        <footer>
        </footer>
    </div>

I have copied and pasted the code for the menu above (starting with @(html.) into an view in my project.

when i run the project and navigate to the view the menu is there but does nothing - no hver effect no sub menu drop down.

could anyone help to as where im going wrong please?

here is the code for the view

@{
    ViewBag.Title = "Home Page";
}

<h2>@ViewBag.Message</h2>

            @(Html.Telerik().Menu()
                    .Name("menu")
                    .Items(items =>
                {
                    items.Add().Text("Parent 1").Items(sub1 =>
                        {
                            sub1.Add().Text("About").Url("Home/About");
                        });
                    items.Add().Text("Parent 2");
                }))


thanks in advance

1 Answer, 1 is accepted

Sort by
0
Martin
Top achievements
Rank 1
answered on 09 Apr 2012, 10:51 PM
neal,

I'm unclear. Are the master page and the view visible at the same time? I had a similar problem where the menu worked inside of one tab of a tab control but not in another tab in the same page. It turned out that the two menus in the two tabs both had the same name, and that was confusing the javascript that drives the menu. When I gave the two menus different names, they started to work properly.

Maybe try different names for your menus. I hope this helps!

Martin

Tags
Menu
Asked by
neal
Top achievements
Rank 1
Answers by
Martin
Top achievements
Rank 1
Share this question
or