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 8079777
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T16:13:05+00:00 2026-06-05T16:13:05+00:00

In my MVC3 Application I am using a controller actionresult to return two sets

  • 0

In my MVC3 Application I am using a controller actionresult to return two sets of Json data to pass to two separate jqGrids in my view.

The return of the controller’s actionresult looks like:

return Json(new
        {
            A= holderA,
            B= holderB
        },JsonRequestBehavior.AllowGet);  

Where A and B are arrays of data that were obtained from LINQ to SQL queries.

I have to jquery jqGrids in my View, and the first one should accept the data from “Part A” of my result, and the second grid should accept the data from “Part B” of my result.

I need to know how to access each individual component of my actionresult (i.e. A and B) in jqGrid, is there a specific option that allows your to reference where the data is coming from?

If it helps here is what one grid looks like…

jQuery("#GridA").jqGrid({
        url: "/MyController/MyActionresult",
        datatype: 'json',
        postData: {
            Name: function () {
                return $("#Name").val();
            },
            Year: function () {
                return $("#SelectedYear").val()
            }
        },

        mtype: 'POST',
        colNames: ['Name', 'Age', 'Total']
        colModel: [

                { name: 'Name', index: 'Name', align: 'left' },
                { name: 'Age', index: 'Age', align: 'left' },
                { name: 'Total', index: 'Total', width: 150, align: 'left', search: false }],
        pager: jQuery('#GridAPager'),
        rowNum: 250,
        height: 250,
        rowList: [250, 500, 1000, 2000],
        sortname: 'Name',
        sortorder: "asc",
        viewrecords: true,
        hiddengrid: false,
        caption: 'List of People',
        gridComplete: function () {
            onGridComplete("#GridA");}
    });
    $("#GridA").jqGrid('filterToolbar', { stringResult: true, searchOnEnter: true });
});

And the second grid is almost identical with slightly different fields being displayed.

The reason I would prefer to pass both data sets back from one actionresult is because both grids are being populated once a form submit button is clicked.

Any help would be great,

Thanks.

  • 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-05T16:13:07+00:00Added an answer on June 5, 2026 at 4:13 pm

    It’s important to know the exact format of the data in holderA and holderB. You should define jsonReader which correspond the data structure.

    You should understand that if you would uses the option mtype: 'POST' the returned data could not be cached and for filling of “#GridA” and “#GridB” different requests will be done. So you will have no advantage from combining of two responses in one Action.

    Moreover if the user click for example on the column header of column ‘Name’ of “#GridA” one more request will be send to the URL "/MyController/MyActionresult". In the request the value of parameter sord will be “desc” instead of “asc” in the initial request. New requests to the server will be send also if the user change the page size from 250 to 500 or if the user change the page which need be displayed.

    I tried to explain that it has sense to have separate actions for all grids which you have on the page. The combining all in one have not so much sense if not all data will be displayed and if you have server side sorting and paging implemented.

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

Sidebar

Related Questions

I'm currently working on my first MVC3 application at work (using the Razor view
I am using jquery modal popup in my application with MVC3 Razor view. Issue
Simply put serializing data in the application/json; charset=utf-8 format misbehaves in MVC3 (and possibly
I'm using EF 4.3 in an MVC4 application and Ninject.MVC3. Controllers are MVCscaffolded using
I am working on an MVC3 application using the Razor syntax and I have
I am creating an ASP.NET MVC3 application using NHIBERNATE. I have a base class
I am using SignalR in my MVC3 application, and since I have implemented StructureMap
I am going to build my application using asp.net mvc3 and nhibernate 3.2. I
I am using mvc3 to develop an database application and followed the Code-First Tutorial
I am using Ninject in MVC3 application. One of my resolvable dependencies makes use

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.