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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T00:58:49+00:00 2026-06-06T00:58:49+00:00

i’m starter in jqgrid, i write this code for create and fill jqgrid(i’m use

  • 0

i’m starter in jqgrid, i write this code for create and fill jqgrid(i’m use repository pattrn in asp.net )

    namespace Clearance.Helper
    {
        using System;
        public class JQGridRow
        {
            public int id;
            public string[] cell;
        }
    }

    namespace Clearance.Helper
    {
        public class JQGridResults
        {
            public int Page { get; set; }
            public int Total { get; set; }
            public int Records { get; set; }
            public JQGridRow[] rows;
        }
     }

namespace Clearance.Business
{
    using System;
    using System.Linq;
    using Model;
    using Clearance.Repository;
    using System.Collections.Generic;
    using System.Web.Script.Serialization;
    using Clearance.Helper;
    public class TransportTypesBusiness : GenericBusiness<CLEARANCEEntities, TRANSPORT_TYPES>
    {


    public List<TRANSPORT_TYPES> GetAll(int pageSize, int pageIndex)
            {
                var repository = new TransportTypesRepository(this.Context);
                return (List<TRANSPORT_TYPES>) repository.GetAll().OrderBy(c => c.TRANSPORT_ID).Skip(pageIndex * pageSize).Take(pageSize);
            }




     public string BuildJQGridResults(int numberOfRows = 0, int pageIndex = 0, int totalRecords = 0)
            {
                var result = new JQGridResults();
                var rows = new List<JQGridRow>();
                var list = GetAll(numberOfRows, pageIndex);
                int li = list.Count();
                totalRecords = list.Count();
                foreach (var item in list)
                {
                    var row = new JQGridRow { id = item.TRANSPORT_ID, cell = new string[4] };
                    row.cell[0] = item.TRANSPORT_ID.ToString();
                    row.cell[1] = item.TRANSPORT_NAME;
                    row.cell[2] = item.TRANSPORT_ABBR;
                    row.cell[3] = item.REMARK;
                    rows.Add(row);
                }
                result.rows = rows.ToArray();
                if ((numberOfRows != 0) && (pageIndex != 0) && (totalRecords != 0))
                {
                    result.Page = pageIndex;
                    result.Total = (totalRecords + numberOfRows - 1) / numberOfRows;
                    result.Records = totalRecords;
                }

                return new JavaScriptSerializer().Serialize(result);
            }
}}

and js code

  $(function () {
                var grid = $('#list');
                grid.jqGrid({
                    url: 'jQGridHandler.ashx',
                    editurl: 'jQGridHandler.ashx',
                    postData: { ActionPage: 'TransportType', Action: 'Fill' },
                    ajaxGridOptions: { cache: false },

                    datatype: 'json',
                    height: 'auto',
                    colNames: ['TRANSPORT_ID', 'TRANSPORT_NAME', 'TRANSPORT_ABBR', 'REMARK'],
                    colModel: [
                            { name: 'TRANSPORT_ID', index: 'TRANSPORT_ID', key: true, hidden: true, editable: false },
                            { name: 'TRANSPORT_NAME', width: 200, sortable: true, editable: true },
                            { name: 'TRANSPORT_ABBR', width: 100, sortable: true, editable: true },
                            { name: 'REMARK', width: 100, sortable: true, editable: true }
                           ],
                    rowNum: 10,
                    rowList: [10, 20, 30],
                    pager: '#pager',
                    prmNames: { nd: null },
                    gridview: true,
                    sortname: 'TRANSPORT_ID',
                    viewrecords: true,
                    caption: '',
                    rownumbers: true

                });

when jqgrid load data set current page is 0 and icon next and privice is enable. please help me. thanks all

  • 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-06T00:58:51+00:00Added an answer on June 6, 2026 at 12:58 am

    The problem with page number can be easy to solved. The class JQGridResults has properties Page, Total, Records and rows, but default names which jqGrid wait for are page, total, records and rows. So the rows are the only property which will be read correctly.

    To fix the problem you can either rename the property in the JQGridResults or include the following additional parameter in jqGrid:

    jsonReader: {page: "Page", total: "Total", records: "Records"}
    

    More additional information (inclusive full working Visual Studio demo project) about the usage of jqGrid together with ASHX handler you can find in the answer.

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

Sidebar

Related Questions

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'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I have this code: - (void)parser:(NSXMLParser *)parser foundCDATA:(NSData *)CDATABlock { NSString *someString = [[NSString
link Im having trouble converting the html entites into html characters, (&# 8217;) i
For some reason, after submitting a string like this Jack’s Spindle from a text
I am trying to understand how to use SyndicationItem to display feed which is
Basically, what I'm trying to create is a page of div tags, each has
this is what i have right now Drawing an RSS feed into the php,
I want use html5's new tag to play a wav file (currently only supported

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.