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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T09:40:42+00:00 2026-05-18T09:40:42+00:00

I am developing the ASP.NET MVC 2 application . I want to show the

  • 0

I am developing the ASP.NET MVC 2 application . I want to show the gird of list of object data. like List<MyObject>. So I tried a code in controller action as:

[HttpGet]
public ActionResult JsonSalesCollection()
{
    string id = Request.QueryString["id"];

    ViewData["TrustId"] = id;
    Guid id1 = new Guid(id);

    List<TrustContract> contractList = trustContractmang.GetListOfTrustContractByTrustId(id1);
    int pageIndex = 12;
    int pageSize = 20;
    int totalRecords = contractList.Count();
    int totalPages = (int)Math.Ceiling((float)totalRecords / (float)pageSize);
    string orderBy = string.Format("{0} {1}", "TrustContracId", "desc");

    var jsonData = new
    {
        total = totalPages,
        page = 20,
        records = totalRecords,
        rows = (
            from s in contractList
            select new
            {
                i = s.TrustContracId,
                cell = new string[] {
                    s.TrustContracId.ToString(),
                    s.Trust.TrustName.ToString(),
                    s.ContractStartDate.ToShortDateString(),
                    s.ContractEndDate.ToShortDateString(),
                    s.ContractAmount.ToString(), 
                    s.RecoveredAmount.ToString(),
                    s.IsCompleted.ToString()
                }
            }).ToArray()
    };

    return Json(jsonData);
}

This is running fine, also generating JSON result. On the view page I am using script :

var gridimgpath = '/Scripts/jqgrid/themes/redmond/images';

var TrustId = <%= serializer.Serialize(ViewData["TrustId"]) %>;

// use date.js to calculate the values for this month
var gridDataUrl = '/NewTrustContract/JsonSalesCollection?id='+ TrustId;

$("#list").jqGrid({
    url: gridDataUrl,
    datatype: "json",
    mtype: 'GET',

    colNames: ['TrustContracId', 'Trust', 'Contract Start Date',
               'Contract End Date', 'Contract Amount', 'Recovered Amount',
               'Is Completed'],
    colModel: [
        { name: 'TrustContracId', index: 'TrustContracId', width: 50, align: 'left' },
        { name: 'Trust', index: 'Trust', width: 100, align: 'left' },
        { name: 'ContractStartDate', index: 'ContractStartDate', width: 100, align: 'left' },
        { name: 'ContractEndDate', index: 'ContractEndDate', width: 100, align: 'left' },
        { name: 'ContractAmount', index: 'ContractAmount', width: 100, align: 'left' },
        { name: 'RecoveredAmount', index: 'RecoveredAmount', width: 100, align: 'right' },
        { name: 'IsCompleted', index: 'IsCompleted', width: 100, align: 'right' }
    ],
    rowNum: 20,
    rowList: [10, 20, 30],
    imgpath: gridimgpath,
    height: 'auto',
    width: '900',
    pager: jQuery('#pager'),
    sortname: 'TrustContracId',
    viewrecords: true,
    sortorder: "desc",
    caption: "Contract"
});

ok, for this I used :

< table id="list" class="scroll" cellpadding="0" cellspacing="0" >< /table > 
< div id="pager" class="scroll" style="text-align:center;" >< /div  >

to hold the grid.I can even see empty grid view on .aspx page on view. but not appearing data. So is this mean i have to manually iterate JSON data in jquery. if yes, then where i can get JSON data in j query. and how to iterate it. i know onli $.each is use for iterate data. but how to get data in var? or another remedy for this functionality?

From where should i get jqgrid brief documentation for read?

  • 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-18T09:40:42+00:00Added an answer on May 18, 2026 at 9:40 am

    It is some how done. For this success I have to use JsonResult instead of ActionResult. also need to add [AcceptVerbs(HttpVerbs.Get)] attribute before action definition. and while return I used

    return Json(jsonData,JsonRequestBehavior.AllowGet);
    

    Thats it, it is running fine now.

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

Sidebar

Related Questions

I am developing an ASP.NET MVC application and I want to use OpenId. What
I am in the process of developing a large ASP.NET MVC application. I am
Hi I am developing a simple application based upon ASP.NET MVC. I have altered
I'm developing an ASP.Net MVC site and on it I list some bookings from
On an ASP.NET MVC (Beta) site that I am developing sometimes calls to ActionLink
I've been developing a site using ASP.NET MVC, and have decided to use the
I've been developing a simple website using asp.net MVC and I'm starting to add
Duplicate: Should I pursue ASP.NET WebForms or ASP.NET MVC? We are developing an enterprise
I developing ASP.NET application using a Swedish version of Windows XP and Visual studio
I am developing an ASP.NET Ajax form, and decided to make most of the

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.