jQuery选项卡显示ASP.NET MVC 4中不同控制器的详细信息 [英] jQuery tabs showing details from different controllers in ASP.NET MVC 4
问题描述
我是ASP.NET MVC 4的新手。我想知道如果可能的话我可以使用jQuery tabcontrol来显示每个选项卡上不同控制器的详细信息视图。
我可以在剃须刀视图中设置这样的标签控件:
I am very new to ASP.NET MVC 4. I am wondering how if possible I can have a jQuery tabcontrol which will show a details views from different controllers on each tab.
I can set up the tab control like this in the razor view:
@model APPCENTER_MVC.ViewModels.ViewModel
@{
ViewBag.Title = "APPLICATION CATALOG";
}
@section featured {
<section class="featured">
<div class="content-wrapper">
<hgroup class="title">
<h1>@ViewBag.Title.</h1>
<h2>@ViewBag.Message</h2>
</hgroup>
</div>
</section>
}
@section Scripts {
<section class="Jscripts">
<script type="text/javascript">
$(function () {
$("#tabs").tabs();
});
</script>
</section>
}
<div id="tabs">
<ul>
@foreach (var item in Model.Category.ToList())
{
<li>
<a href="tabs-@item.ID">@Html.DisplayFor(modelItem => item.Category1)</a>
</li>
}
</ul>
</div>
添加代码块[/编辑]
现在我想为不同类别的每个创建的标签添加详细信息视图。非常感谢任何帮助。
谢谢
Ryan
Add Code Block [/Edit]
Now I would like to add the details view for each of the created tabs for the different categories. Any help would be very much appreciated.
Thanks
Ryan
推荐答案
( function (){
( # tabs)。tabs();
});
< / script >
< / section >
}
< div id = 标签 >
< ; ul >
@foreach(Model.Category中的var项目。 ToList())
{
< li >
< a href = tabs-@item.ID > @ Html.DisplayFor( modelItem => item.Category1)< / a >
< / li >
}
< / ul >
< / div >
("#tabs").tabs(); }); </script> </section> } <div id="tabs"> <ul> @foreach (var item in Model.Category.ToList()) { <li> <a href="tabs-@item.ID">@Html.DisplayFor(modelItem => item.Category1)</a> </li> } </ul> </div>
添加代码块[/编辑]
现在我想为不同类别的每个创建的标签添加详细信息视图。非常感谢任何帮助。
谢谢
Ryan
Add Code Block [/Edit]
Now I would like to add the details view for each of the created tabs for the different categories. Any help would be very much appreciated.
Thanks
Ryan
使用 RenderPartial [ ^ ]您可以嵌入任何局部视图。假设你应该走这条路。但如果你真的需要中间的控制器,你可以使用 RenderAction [ ^ ]。
With RenderPartial[^] you can embed any partial view. Is suppose, you should go this way. But if you really need a controller in-between, you can use RenderAction[^].
这篇关于jQuery选项卡显示ASP.NET MVC 4中不同控制器的详细信息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!