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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T02:58:46+00:00 2026-06-05T02:58:46+00:00

I am using JQGrid with the Trirand.Web.Mvc class, and trying to figure out how

  • 0

I am using JQGrid with the Trirand.Web.Mvc class, and trying to figure out how to do custom paging.

I have seen the paging demos here

The problem with these demos is that they bind directly to a linq context object and lets MVC take care of the paging.

    // This method is called when the grid requests data. You can choose any method to call        
    // by setting the JQGrid.DataUrl property        
    public JsonResult PerformanceLinq_DataRequested()        
    {            
        // Get both the grid Model and the data Model            
        // The data model in our case is an autogenerated linq2sql database based on Northwind.            
        var gridModel = new OrdersJqGridModel();            
        var northWindModel = new NorthwindDataContext();            
        // return the result of the DataBind method, passing the datasource as a parameter            
        // jqGrid for ASP.NET MVC automatically takes care of paging, sorting, filtering/searching, etc
        return gridModel.OrdersGrid.DataBind(northWindModel.OrdersLarges);        
    }    

The data set I want to bind to is quite complex and I am returning it from a stored procedure, which does the paging for me.

So all I have to give JQGrid is the correct size of rows for a specific page of the entire resultset. I can also return the total row count.

So I have my results in a List myListOfObjects.

I can pass this into the DataBind using myListOfObjects.AsQueryable()

The problem is, JQGrid thinks there is only {page size} rows, so does not display any of the paging options.

Is it possible to pass in the total row count?

Other grids, like Teleriks MVC grid allows you to pass in the Total row count, and it displays the paging correctly

  • 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-05T02:58:47+00:00Added an answer on June 5, 2026 at 2:58 am

    Ok, so I’ve managed to solve this myself. There may be other ways to do it, if so I’d love to hear them!

    The JQGrid.DataBind produces an JsonResult object, whose Data value is set to Trirands own object Trirand.Web.Mvc.JsonResponse

    It’s an internal class to their Trirand.Web.Mvc, so i had to copy its structure which I could see using Visual Studio debugging.

    It has:

    • page – the current page number
    • records – the total record count
    • rows – of type Trirand.Web.Mvc.JsonRow (which I need to replicate too)
    • total – the total number of pages needed

    JsonRow looks like:

    • cell – a string array of your columns
    • id – your row ID

    So my code looked like this:

    var jsonList = new List<JSONRow>();
    myData.ForEach(x => jsonList.Add(new JSONRow(x)));
    
    var jsonResult = Json (new
                                {
                                    page = page,
                                    rows = jsonList.ToArray(),
                                    records = totalRows,
                                    total = Math.Round((double)totalRows / rows, MidpointRounding.AwayFromZero)
                                }, JsonRequestBehavior.AllowGet);
    
    
       return jsonResult;
    

    My JsonRow looks like this:

    public class JSONRow
            {
                public string[] cell { get; set; }
                public string id { get; set; }
    
                public JSONRow(MyObjectType myObject)
                {
                    id = myObject.id;
                    cell = new string[3];
                    cell[0] = myObject.Col1;
                    cell[1] = myObject.Col2?? "";
                    cell[2] = myObject.Col3?? "";
    
                }
            }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Using the jqGrid i am trying to figure out how to dynamically load my
I am using jqgrid and using the inline editing mode and can't figure out
I have been using Trirand's jqGrid with ASP.NET MVC3 as well as the jquery.jqgrid
I am using jqGrid ( http://www.trirand.com/blog/ ) to display some read-only data. The resizeable
I'm using jqGrid and I have a problem getting Dynamic Linq to work. I
I am using JQGrid I have it on 2 domains (same code)... On domain
I am using jqgrid and I like to display custom message while deleting a
I am using JQGrid to get the date from the RESTFul web services that
I'm using JQgrid, with a select/dropdown in my project, and have implemented it in
<%= Html.Trirand().JQGrid(Model.OrderGrid,Grid1)%> I need to call this using javascript? Can anybody tell me? <%=

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.