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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T15:32:56+00:00 2026-05-19T15:32:56+00:00

i’m trying to make the navigation arrows in jqGrid working. MVC 3 RC2, Entity

  • 0

i’m trying to make the navigation arrows in jqGrid working.
MVC 3 RC2, Entity Framework 4, .NET Framework 4, jqGrid 3.8.2

The Problem is, that i’m getting not record from 1 to 10, 11 to 20 and so on. It seems that the .skip method is not working correctly.

jqGrid calls the ActionResult with the right parameters.

Maybe you have an idea?

Regards,
float

    //
    // Post: /Admin/IndexGridData
    // Gibt ein JSON Result mit allen Aufträgen für das jqGrid zurück
    [HttpPost]
    public ActionResult IndexGridData(string sidx, string sord, int page, int rows)
    {

        // Ermittlung der Zusatzinformationen die das Grid anzeigt (Anzahl Aufträge, momentan angezeigte Aufträge
        int start = (page -1) * rows;
        int summeauftraege = _db.Auftrag.Where(x => x.AuftragStatus != "storno").Count();
        int totalPages = (int)Math.Ceiling((float)summeauftraege / (float)rows);

        var auftraege = (from auftrag in _db.Auftrag
                     .Include("KT_AuftragStatus")
                     .Include("KT_Bearbeitungsort")
                     .Include("AuftragPartner")
                         select new
                         {
                             Titel = auftrag.Titel,
                             Auftrag_GUID = auftrag.Auftrag_GUID,
                             Bearbeitungsort = auftrag.KT_Bearbeitungsort.Text,
                             AuftragStatus = auftrag.KT_AuftragStatus.Text,
                         }).Where(x => x.AuftragStatus != "storniert").OrderBy(x => x.Titel)
                     .Skip(start)
                     .Take(rows)
                     .AsEnumerable().ToList();

        // Sortierung des Grids anwenden
        if (sidx == "Titel" && sord == "asc")
        {
            auftraege = auftraege.OrderBy(x => x.Titel).AsEnumerable().ToList();
        }
        else if (sidx == "Titel" && sord == "desc")
        {
            auftraege = auftraege.OrderByDescending(x => x.Titel).AsEnumerable().ToList();
        }else if (sidx == "Bearbeitungsort" && sord == "asc")
        {
            auftraege = auftraege.OrderBy(x => x.Bearbeitungsort).AsEnumerable().ToList();
        }
        else if (sidx == "Bearbeitungsort" && sord == "desc")
        {
            auftraege = auftraege.OrderByDescending(x => x.Bearbeitungsort).AsEnumerable().ToList();
        }
        else if (sidx == "AuftragStatus" && sord == "asc")
        {
            auftraege = auftraege.OrderBy(x => x.AuftragStatus).AsEnumerable().ToList();
        }
        else if (sidx == "AuftragStatus" && sord == "desc")
        {
            auftraege = auftraege.OrderByDescending(x => x.AuftragStatus).AsEnumerable().ToList();
        }           


        // Erstellung des JSON Objekts welches die einzelnen Aufträge enthält
        var jsonauftraege = new object[auftraege.Count()];
        for (int i = 0; i < auftraege.Count; i++)
        {
            jsonauftraege[i] = new
            {
                id = auftraege[i].KA_Auftrag_GUID,
                cell = new[] { 
                "Details",
                "Bearbeiten",
                (auftraege[i].Titel != null) ? auftraege[i].Titel.ToString(): "&nbsp;", 
               (auftraege[i].Bearbeitungsort != null) ? auftraege[i].Bearbeitungsort.ToString(): "&nbsp;", 
                (auftraege[i].AuftragStatus != null) ? auftraege[i].AuftragStatus.ToString(): "&nbsp;", 
            }
            };
        }

        // Erstellung des JSON Results welches das Grid versteht
        var result = new JsonResult();
        result.Data = new { page = page, records = summeauftraege, rows = jsonauftraege, total = totalPages };

        return Json(result.Data);
    }
  • 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-19T15:32:56+00:00Added an answer on May 19, 2026 at 3:32 pm

    here is the solution:

        //
        // Post: /Admin/IndexGridData
        // Gibt ein JSON Result mit allen Aufträgen für das jqGrid zurück
        [HttpPost]
        public ActionResult IndexGridData(string sidx, string sord, int page, int rows)
        {
    
            // Ermittlung der Zusatzinformationen die das Grid anzeigt (Anzahl Aufträge, momentan angezeigte Aufträge
            int start = (page - 1) * rows;
    
    
           var auftraege = _db.Auftrag
                             .Where(x => x.AuftragStatus != "storno")
                             .OrderBy(x => x.Titel)
                             .Select(auftrag => new AuftragModels.GridAnsicht
                             {
                                 Auftrag_GUID = auftrag.Auftrag_GUID,
                                  Titel = auftrag.Titel,
                                 Bearbeitungsort = auftrag.KT_Bearbeitungsort.Text,
                                 AuftragStatus = auftrag.KT_AuftragStatus.Text,
                             }
                              );
            }
    
    
            // zusammen gesetztes SQL Statement speichern
            var sqlstring = ((ObjectQuery)auftraege).ToTraceString();
    
            // Sortierung des Grids anwenden
            if (sidx == "Titel" && sord == "asc")
            {
                auftraege = auftraege.OrderBy(x => x.Titel);
            }
            else if (sidx == "Titel" && sord == "desc")
            {
                auftraege = auftraege.OrderByDescending(x => x.Titel);
            }
            else if (sidx == "Bearbeitungsort" && sord == "asc")
            {
                auftraege = auftraege.OrderBy(x => x.Bearbeitungsort);
            }
            else if (sidx == "Bearbeitungsort" && sord == "desc")
            {
                auftraege = auftraege.OrderByDescending(x => x.Bearbeitungsort);
            }
            else if (sidx == "AuftragStatus" && sord == "asc")
            {
                auftraege = auftraege.OrderBy(x => x.AuftragStatus);
            }
            else if (sidx == "AuftragStatus" && sord == "desc")
            {
                auftraege = auftraege.OrderByDescending(x => x.AuftragStatus);
            }
    
            // zusammen gesetztes SQL Statement speichern
            //sqlstring = ((ObjectQuery)auftraege).ToTraceString();
    
            // aufträge zu einer Liste speichern, damit diese durchlaufen werden kann
            var auftragListe = auftraege
                             .AsEnumerable().ToList();
    
            // Anzahl der Seiten berechnen
            int summeauftraege = auftragListe.Count();
            int totalPages = (int)Math.Ceiling((float)summeauftraege / (float)rows);
    
            // nur die Aufträge anzeigen, die auf eienr Seite sichtbar sind
            auftragListe = auftragListe
                             .Skip(start)
                             .Take(rows)
                             .AsEnumerable().ToList();
    
            // Erstellung des JSON Objekts welches die einzelnen Aufträge enthält
            var jsonauftraege = new object[auftragListe.Count()];
            for (int i = 0; i < auftragListe.Count(); i++)
            {
                jsonauftraege[i] = new
                {
                    id = auftragListe[i].Auftrag_GUID,
                    cell = new[] { 
                    "Details",
                    "Bearbeiten",
                    (auftragListe[i].Titel != null) ? auftragListe[i].Titel.ToString(): "&nbsp;", 
                    (auftragListe[i].Bearbeitungsort != null) ? auftragListe[i].Bearbeitungsort.ToString(): "&nbsp;", 
                    (auftragListe[i].AuftragStatus != null) ? auftragListe[i].AuftragStatus.ToString(): "&nbsp;", 
                }
                };
            }
    
            // Erstellung des JSON Results welches das Grid versteht
            var result = new JsonResult();
            result.Data = new { page = page, records = summeauftraege, rows = jsonauftraege, total = totalPages };
    
            return Json(result.Data);
        }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
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
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I'm new to using the Perl treebuilder module for HTML parsing and can't figure
Seemingly simple, but I cannot find anything relevant on the web. What is the
Does anyone know how can I replace this 2 symbol below from the string
this is what i have right now Drawing an RSS feed into the php,
I have just tried to save a simple *.rtf file with some websites and

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.