开发者

Telerik MVC menu not showing child items

开发者 https://www.devze.com 2023-02-28 18:21 出处:网络
I have the following Telerik MVC Menu extension, and it behaves as expected in one project, and not in another.I have tried to identify differences between the projects to no avail, and I even copy an

I have the following Telerik MVC Menu extension, and it behaves as expected in one project, and not in another. I have tried to identify differences between the projects to no avail, and I even copy and pasted the menu from the working project to the non-working one.

When I say working and non-working, I mean that in the working project, the menu styling looks correct and hovering over a menu item expands sub-items. In the non-working project the styling looks incomplete and hovering over a menu item does nothing.

<div style="text-align: left; clear: left;">
            @(Html.Telerik().Menu()
               .Name("TopMenu")
               .Orientation(MenuOrientation.Horizontal)
               .Items(menu =>
                   {
                       menu.Add().Text("Rate Cards").Action("Index", "RateCard");
                       menu.Add().Text("Campaigns").Action("Index", "Campaign");
                开发者_高级运维       menu.Add().Text("Contracts").Action("Index", "Contract").Enabled(false);
                       menu.Add().Text("Sites").Action("Index", "Site");
                       menu.Add().Text("Products").Action("Index", "Product");
                       menu.Add().Text("Config").Items(submenu =>
                               {
                                   submenu.Add().Text("Suburbs").Action("Index", "Suburb");
                                   submenu.Add().Text("Cities").Action("Index", "City");
                                   submenu.Add().Text("Provinces").Action("Index", "Province");
                               });                                         
                   })
               .HighlightPath(true)
               .ItemAction(item =>
                   {
                       if (item.Selected)
                           item.HtmlAttributes["class"] = "t-state-selected";
                   })
            )
</div>


please trace the javascript files loaded both in working and non working project. The menu is quite simple and does not use any model (set of static text values) so only thing that might create problem is missing js file


Probably a JavaScript or CSS file failed to load (maybe both).

Check with some web developer tool program (FireBug, IE or Chrome dev tools) for any failing HTTP requests. Also if you are using asset combination make sure the asset.axd HTTP handler is properly registered in your web.config. Check this help article for the right setting.


Just add this at the end of your master or main layout

@Html.Telerik().ScriptRegistrar()

Note: Please make sure you have all scripts and css files under Content and Script folders.

Talley

0

精彩评论

暂无评论...
验证码 换一张
取 消