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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T05:10:56+00:00 2026-05-31T05:10:56+00:00

When I click the FilterButton it hits the alert everytime, after every click. However,

  • 0

When I click the FilterButton it hits the alert everytime, after every click. However, the action method GridData is only getting hit the first time through. Do you know why?

$(document).ready(function () {

            $('#FilterButton').click(function () {

                alert('button clicked');

                var myGrid = jQuery("#list").jqGrid({
                    url: '/Data/GridData/',
                    datatype: 'json',
                    mtype: 'POST',
                   ......

Here is the requested Action Method

 [HttpPost]
    public JsonResult GridData(string sidx, string sord, int page, int rows, string species, string methodOfTake, string outputType, string seasons, string years)
    {          

        var results = (from a in db.t_harvest_statistics_elk
                        where a.year == "2008" && a.unit_number == 1
                        orderby a.id
                        select new { a.id, a.year, a.unit_number, a.total_hunters, a.bulls, a.cows }).ToList(); 

        int pageIndex = Convert.ToInt32(page) - 1;
        int pageSize = rows;
        int totalRecords = results.Count();   
        int totalPages = (int)Math.Ceiling((float)totalRecords / (float)pageSize);

        var pageResults = results.Skip(pageIndex * pageSize).Take(pageSize);           

        var jsonData = new
        {
            total = totalPages,
            page,
            records = totalRecords,
            rows = (
                from pageResult in pageResults
                select new
                {
                    id = pageResult.id,
                    cell = new[] { 
                                    pageResult.year.ToString(),
                                    "Add",
                                    pageResult.unit_number.ToString(),                                         
                                    pageResult.total_hunters.ToString(),
                                    pageResult.bulls.ToString(),
                                    "add",
                                    pageResult.cows.ToString(),
                                    "add",
                                    "add",
                                    "add"

            }
                }).ToArray()
        };


        return Json(jsonData, JsonRequestBehavior.AllowGet); 
    }
  • 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-31T05:10:57+00:00Added an answer on May 31, 2026 at 5:10 am

    The jqGrid control is an interesting beast.

    What is happening here is that you’re first call is initialising the grid, and therefore setting up the grid for the first time will initialise the data needed for the grid. This initialisation is calling the controller action and is the reason it’s hitting the breakpoint the first time.

    For each subsequent click, what’s happening is that you’re calling the jqGrid() method, but because it’s already initialised, it’s ignoring the call and therefore not setting the parameters you specify.

    What you need to do instead is call the “setGridParam” method which will allow you to update the jqGrid parameters like so:

    jQuery('#list').setGridParam({
                        url: '/Data/GridData/',
                        datatype: 'json',
                        mtype: 'POST',
                        ...
    ); 
    

    after you’ve changed the grid parameters, you need to trigger a refresh like so:

    jQuery('#list').trigger("reloadGrid");  
    

    It’s not the most intuitive setup, but this is how jqGrid works.

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

Sidebar

Related Questions

First click: empty floatymessage div. second click and after: works. jQuery: function floatymessage(message){ var
The 'click sound' in question is actually a system wide preference, so I only
I click on items in my listbox and then hit a submit button, but
jQuery mobile button renders gibberish for filter button after clicking on pagination. Click event
Right-click > Events > Action > actionPerformed adds the mouse-down event to a NetBeans
when click on the these links show first click in result 1 then click
After I click button1, it display 0, why? How can get correct width of
Every time I double-click on an XML file, a spreadsheet thing opens. I find
Example: click first link, view contents. Click second link and have contents replaced with
When click on the Child , Parent and Child are firing the alert .

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.