Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C# ASP.NET MVC jQuery Razor
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>
 
[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 11-Dec-12 6:00am
Edited 11-Dec-12 7:04am
v2
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

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[^].
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

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...
  Permalink  

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

  Print Answers RSS
0 Sergey Alexandrovich Kryukov 841
1 OriginalGriff 245
2 Volynsky Alex 205
3 Kishore Pogaru 140
4 Magic Wonder 129
0 OriginalGriff 5,640
1 Sergey Alexandrovich Kryukov 4,693
2 CPallini 4,540
3 George Jonsson 3,132
4 Gihan Liyanage 2,445


Advertise | Privacy | Mobile
Web04 | 2.8.140916.1 | Last Updated 11 Dec 2012
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100