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

  • SEARCH
  • Home
  • 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 697517
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T03:10:35+00:00 2026-05-14T03:10:35+00:00

Greetings, I have a problem using jqgrid and jquery tab (I am coding in

  • 0

Greetings,
I have a problem using jqgrid and jquery tab (I am coding in asp.net mvc)
I have two tabs. Each tabs should contains jqgrid with different data.
I specify tabs as follows:

<script type="text/javascript">
    $(document).ready(function() {
        $("#tabs").tabs();
        getContentTab (1);
    });

    function getContentTab(index) {
        var url='<%= Url.Content("~/Admin/GetWorkspaces") %>/' + index;
        var targetDiv = "#tabs-" + index;
        var ajaxLoading = "<img id='ajax-loader' src='<%= Url.Content("~/Content") %>/ajax-loader.gif' align='left' height='28' width='28'>";

        $(targetDiv).html("<p>" + ajaxLoading + " Loading...</p>"); 

        $.get(url,null, function(result) {
            $(targetDiv).html(result);
        });
    }

</script>
    <div id="tabs">
    <ul>
        <li><a href="#tabs-1" onclick="getContentTab(1);">tab1</a></li>
        <li><a href="#tabs-2" onclick="getContentTab(2);">tab2</a></li>
    </ul>
    <div id="tabs-1">

    </div>
    <div id="tabs-2">

    </div>
</div>   

As seen above GetWorkspaces action gets my tabs:

public ActionResult GetWorkspaces(int id)
    {
        string viewName = string.Empty;

        switch (id)
        {
            case 1:
                viewName = "MarketplaceOfferView";
                break;
            case 2:
                viewName = "MyMessagesView";
                break;
        }
        return PartialView(viewName);
    }

each of view is a partial view. In these partial views I have jqgrids specified as follows:

<script type="text/javascript">
jQuery("#list").ready(function() {
    jQuery("#list").jqGrid({
        url: '/Admin/GetGridData/',
        datatype: 'json',
        mtype: 'GET',
        colNames: ['Klient', 'Zapytanie', 'Atrakcyjność', 'Cena', 'Data początkowa', 'Data końcowa', 'Branża', 'Lokalizacja' ],
        colModel: [
              { name: 'CompanyName', index: 'CompanyName', width: 150, align: 'left' },
              { name: 'Content', index: 'ContactName', width: 300, align: 'left' },
              { name: 'Rating', index: 'Address', width: 150, align: 'left' },
              { name: 'Price', index: 'City', width: 150, align: 'left' },
              { name: 'Price', index: 'City', width: 150, align: 'left' },
              { name: 'Price', index: 'City', width: 150, align: 'left' },
              { name: 'Price', index: 'City', width: 150, align: 'left' },
              { name: 'Price', index: 'PostalCode', width: 100, align: 'left' }
            ],
        pager: jQuery('#pager'),
        rowNum: 100,
        rowList: [5, 10, 20, 50],
        sortname: 'Operator.FullName',
        sortorder: "asc",
        viewrecords: true,
        imgpath: '/scripts/themes/steel/images',
        caption: 'Historia moich wiadomości',
        height:400
    });
    //        .navGrid(pager, { edit: true, add: false, del: false, refresh: true, search: false });
});

</script>
Historia moich wiadomosci
 <table id="list" class="scroll" cellpadding="0" cellspacing="0" width="100%">
</table>
<div id="pager" class="scroll" style="text-align: center;">
</div>

For second view I have an action: /Admin/GetGridDataForTab2/
THe problem is that I see a jqgrid only when I click on first tab. When I click on second tab the grid is not displayed and /Admin/GetGridData/ is not executed.
Does anybody have an idea what is wrong?

  • 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-05-14T03:10:35+00:00Added an answer on May 14, 2026 at 3:10 am

    It’s probably because of your view. Notice that once the second tab loads, you will have 2 elements with the same ID (list) on the page. So when your selector jQuery("#list") runs, it will find the list element in your first tab and update it, instead of the one in the second tab. You should give them distinct names.

    Just out of curiosity, how come you’re rolling your own ajax behavior for tabs instead of using the one that’s built in?

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

Sidebar

Related Questions

Greetings Everyone I am new in asp.net and i'm using RadControls for Asp.net Ajax
Greeting, I listed two examples of using style propriety for asp.net control. what is
Greetings: I have put together a RESTful web service in .NET 3.5 that takes
Greetings! I have a DropDownList within a FormView which are bound to XmlDataSources: <asp:FormView
Greetings, In an WPF DataGridTemplateColumn I have a CellTemplate using a ListView and a
Greetings. I have a problem with Remember Me possibility. It didn't remember my login.
Greetings, I have a particular object which can be constructed from a file, as
Greetings. I have been looking at Literate Programming a bit now, and I do
Greetings! If I have XML such as this: <Root> <AlphaSection> . . . </AlphaSection>
Greetings! I have some XML like this: <Root> <AlphaSection> . . . </AlphaSection> <BetaSection>

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.