asp.net mvc 4 选项卡 [英] asp.net mvc 4 tabs
问题描述
我正在使用 Visual Studio 2010 ASP.Net MVC4(引擎视图 Razor)开发一个项目,需要制作一个选项卡.我定义了这个脚本和 css:
<link href="@Url.Content("~/Content/themes/base/jquery-ui.css")" rel="stylesheet" type="text/css"/><script src="@Url.Content("~/Scripts/jquery-1.7.1.min.js")" type="text/javascript"></script><script src="@Url.Content("~/Scripts/jquery-ui-1.8.20.min.js")" type="text/javascript"></script><script type="text/javascript">$(函数(){$("#tabs").tabs();});
它还定义了标签的格式 html:
.....但是当执行不显示选项卡时,我该如何解决这个问题.只有showme格式的html,这个:
索引
标签页眉 1
标签页眉 2
标签页眉 3
标签 1 的内容在此处.
标签 2 的内容在此处.
标签 3 的内容在此处.
解决方案 如果你使用 ASP.net MVC4 然后配置 _Layout.cshtml将此行添加到 Head html
@Styles.Render("~/Content/css")@Styles.Render("~/Content/themes/base/css")@Scripts.Render("~/bundles/jquery")@Scripts.Render("~/bundles/jqueryui")@Scripts.Render("~/bundles/modernizr")
并从正文(html)中删除这一行
@Scripts.Render("~/bundles/jquery")
并执行程序并显示标签
I'm working on a project with Visual Studio 2010 ASP.Net MVC4 (engine view Razor) and need to make a tabs.
I define this scrips and css:
<link href="@Url.Content("~/Content/themes/base/jquery-ui.css")" rel="stylesheet" type="text/css" />
<script src="@Url.Content("~/Scripts/jquery-1.7.1.min.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/jquery-ui-1.8.20.min.js")" type="text/javascript"></script>
<script type="text/javascript">
$(function () {
$("#tabs").tabs();
});
</script>
It also defines the format html for the tabs:
<div id="tabs"> .....
but when excecute don't showme the tabs, how I can solve this problem. only showme format html, this:
Index
Tab Header 1
Tab Header 2
Tab Header 3
Content for Tab 1 goes here.
Content for Tab 2 goes here.
Content for Tab 3 goes here.
解决方案 If you work with ASP.net MVC4 then config _Layout.cshtml
add this lines into Head html
@Styles.Render("~/Content/css")
@Styles.Render("~/Content/themes/base/css")
@Scripts.Render("~/bundles/jquery")
@Scripts.Render("~/bundles/jqueryui")
@Scripts.Render("~/bundles/modernizr")
and delete from body (html) this line
@Scripts.Render("~/bundles/jquery")
and execute the program and show the tabs
这篇关于asp.net mvc 4 选项卡的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文