Click here to Skip to main content
12,399,561 members (52,392 online)
Rate this:
 
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
Updated 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
Top Experts
Last 24hrsThis month


Advertise | Privacy | Mobile
Web02 | 2.8.160721.1 | Last Updated 11 Dec 2012
Copyright © CodeProject, 1999-2016
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