Telerik MVC 菜单不显示子项目
我有以下 Telerik MVC 菜单扩展,它在一个项目中的行为符合预期,但在另一个项目中则不然。我试图找出项目之间的差异,但没有成功,我什至将菜单从工作项目复制并粘贴到非工作项目。
当我说工作和非工作时,我的意思是在工作项目中,菜单样式看起来正确,并且将鼠标悬停在菜单项上会展开子项。在非工作项目中,样式看起来不完整,将鼠标悬停在菜单项上不会执行任何操作。
<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>
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>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
请跟踪工作项目和非工作项目中加载的 javascript 文件。菜单非常简单,不使用任何模型(静态文本值集),因此唯一可能产生问题的是缺少 js 文件
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
可能是 JavaScript 或 CSS 文件加载失败(也可能是两者)。
使用某些 Web 开发人员工具程序(FireBug、IE 或 Chrome 开发工具)检查是否有任何失败的 HTTP 请求。另外,如果您使用资产组合,请确保 asset.axd HTTP 处理程序已在您的 web.config 中正确注册。查看此帮助正确设置的文章。
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.
只需将其添加到主布局或主布局的末尾
@Html.Telerik().ScriptRegistrar()
注意:
请确保 Content 和 Script 文件夹下有所有脚本和 css 文件。
塔利
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