Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8672193
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T19:08:25+00:00 2026-06-12T19:08:25+00:00

I’m having a problem with Basic Tabs . I’m rendering the tabs in a

  • 0

I’m having a problem with “Basic Tabs”. I’m rendering the tabs in a View in MVC and then I have bunch of KnockoutJS code in three different Partial Views.

My problem is that Knockout is conflicting with other Knockout code because each Partial View creates a MVVM and applies bindings.

Is there some way I can skip rendering the DIV (with the Partial Views) until the relevant tab is pressed?

Here is my code for the regular View:

<ul class="nav nav-tabs" id="myTab">
    <li class="active"><a href="#attributes">Attributes</a></li>
    <li><a href="#interestgroups">Interest groups</a></li>
    <li><a href="#categories">Categories</a></li>
</ul>
<div class="tab-content">
    <div id="attributes" class="tab-pane active">
        @Html.Partial("_AttributesPartial")
    </div>
    <div id="interestgroups" class="tab-pane">
        @Html.Partial("_InterestGroupsPartial")
    </div>
    <div id="categories" class="tab-pane">
        @Html.Partial("_InterestGroupCategoriesPartial")
    </div>
</div>

<script type="text/javascript">
    $(function () {
        $('#myTab a:first').tab('show');
    });

    $('#myTab a').click(function (e) {
        e.preventDefault();
        $(this).tab('show');
    });
</script>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T19:08:26+00:00Added an answer on June 12, 2026 at 7:08 pm

    Something to watch out for would be calling ko.applyBindings more than once with only one argument.

    For instance—if you have more than one view model on a page (I’m inferring from your question), then you need to scope it, by passing in the container element as the second argument.

    Per your comment, if you want to lazy load the stuff you just have to listen for the ‘shown’ event.

    (this is pseudocode, you’ll have to fill in the details)

    $('#attributes').on('shown', function (e) {
       initKOView(e.target);  // some logic to determine which viewModel to bind to.
    })
    
    function initKOView(target) {
       $(target).load('controller/_RenderPartial?path=' + target, function(data) {
          $(this).html(data);
          // Once the data comes back, apply your bindings and make sure to scope it.
          ko.applyBindings(viewModels[target], this);
       })
    }
    

    As discussed here, there is not really a way to teardown whole sets of bindings currently – so you’ll still want to scope your view model.

    https://github.com/SteveSanderson/knockout/issues/41#issuecomment-749171

    Then in your controller, you’ll want to add a PartialViewResult

    public PartialViewResult _RenderPartial(string path)
    {
        return PartialView(path);
    }
    

    Of course, you can have a separate controller action for each one too, and skip the parameterized loading. Also, you’ll want to nix all of the @Html.Partial() stuff out of your master view too.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an MVC Razor view @{ ViewBag.Title = Index; var c = (char)146;
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I have this code to decode numeric html entities to the UTF8 equivalent character.
I have this code: - (void)parser:(NSXMLParser *)parser foundCDATA:(NSData *)CDATABlock { NSString *someString = [[NSString
I've tracked down a weird MySQL problem to the two different ways I was
I have a view passing on information from a database: def serve_article(request, id): served_article
I have a bunch of posts stored in text files formatted in yaml/textile (from
I ran into a problem. Wrote the following code snippet: teksti = teksti.Trim() teksti
I am trying to loop through a bunch of documents I have to put

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.