Click here to Skip to main content
15,909,437 members
Please Sign up or sign in to vote.
3.00/5 (1 vote)
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:

HTML
@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>


[Edit] 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
Posted
Updated 11-Dec-12 7:04am
v2

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[^].
 
Share this answer
 
Check out http://ericdotnet.wordpress.com/2009/03/17/jquery-ui-tabs-and-aspnet-mvc/[^] You can use ajax to load each tab, rather than loading all tabs at one time...
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900