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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T05:16:46+00:00 2026-05-30T05:16:46+00:00

I can’t get the jqGrid to call my action method on my controller. I’m

  • 0

I can’t get the jqGrid to call my action method on my controller. I’m completely new to this, so I’m probably making a lot of newbie mistakes. I’ve taken samplecode from jqGrids documentation and modified it a bit.

Code in the view:

    $(function () {
    $("#list").jqGrid({
        url: '@Url.Action("GetContactRows", "Contact")',
        datatype: 'json',
        mtype: 'GET',
        colNames: ['Name', 'Address', 'City'],
        colModel: [
          { name: 'Name', index: 'Name', width: 80 },
          { name: 'Address', index: 'Address', width: 80 },
          { name: 'City', index: 'City', width: 80 }
        ],
        pager: '#pager',
        rowNum: 10,
        rowList: [10, 20, 30],
        sortname: 'invid',
        sortorder: 'desc',
        viewrecords: true,
        gridview: true,
        caption: 'List of Contacts'
    });
}); 

Code in the controller:

    public JsonResult GetContactRows(string sidx, string sord, int page, int rows, bool search, string filters)
    {
        System.Diagnostics.Debug.WriteLine("asdf");

        return new JsonResult();
    }

I’ve set a breakpoint in my controller action method, but I just can’t get it to hit.

  • 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-30T05:16:48+00:00Added an answer on May 30, 2026 at 5:16 am

    The parameter must be called _search, not search. Also you don’t seem to be passing any JSON data. Here’s an example:

    public class HomeController : Controller
    {
        public ActionResult Index()
        {
            return View();
        }
    
        public ActionResult GetContactRows(string sidx, string sord, int page, int rows, bool _search, string filters)
        {
            var data = new
            {
                page = 1,
                total = 1,
                records = 3,
                rows = new[]
                {
                    new 
                    {
                        id = 1,
                        cell = new[] { "Name 1", "Address 1", "City 1" },
                    },
                    new 
                    {
                        id = 2,
                        cell = new[] { "Name 2", "Address 2", "City 2" },
                    },
                    new 
                    {
                        id = 3,
                        cell = new[] { "Name 3", "Address 3", "City 3" },
                    }
                }
            };
            return Json(data, JsonRequestBehavior.AllowGet);
        }
    }
    

    Notice the action signature using _search as parameter name and also notice that we allow GET requests by using JsonRequestBehavior.AllowGet when returning the JSON.

    and the view:

    <script src="@Url.Content("~/Scripts/jqgrid/js/jquery.jqGrid.min.js")" type="text/javascript"></script>
    
    <script type="text/javascript">
        $(function () {
            $("#list").jqGrid({
                url: '@Url.Action("GetContactRows", "Home")',
                datatype: 'json',
                mtype: 'GET',
                colNames: ['Name', 'Address', 'City'],
                colModel: [
                  { name: 'Name', index: 'Name', width: 80 },
                  { name: 'Address', index: 'Address', width: 80 },
                  { name: 'City', index: 'City', width: 80 }
                ],
                pager: '#pager',
                rowNum: 10,
                rowList: [10, 20, 30],
                sortname: 'invid',
                sortorder: 'desc',
                viewrecords: true,
                gridview: true,
                caption: 'List of Contacts'
            });
        }); 
    </script>
    
    <table id="list"></table>
    

    <rant>

    Also to be able to easily debug those kind of problems please use a javascript debugging tool such as FireBug. It allows you to see all AJAX requests in your browser as well as what the server sends as response. If you had done that you would have immediately seen this error.

    It took me exactly 70 seconds, to go to the jqGrid web site, download it, create a new ASP.NET MVC 3 application, copy-paste your code, reference jqGrid that I have previously downloaded, hit F5 to run the application, hit F12 in FireFox to open FireBug, see that the AJAX request that jqGrid attempted to perform was shown in red (because the server returned HTTP 500 status code), click on the + sign next to this AJAX request and read the exact exception message sent by the server telling me that it cannot find a value for the search parameter which is a non nullable boolean, click on the Params tab and see the exact parameters sent by the client:

    enter image description here

    Do you see how trivially easy is to do web development when you use the right tools? 70 seconds. It’s faster than asking a question on StackOverflow.

    </rant>

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

Sidebar

Related Questions

Can I get a 'when to use' for these and others? <% %> <%#
I'm new to using the Perl treebuilder module for HTML parsing and can't figure
Can I call select before recv_from on a socket that is blocking?
Can someone maybe tell me why this is not working? I have used echo
Can i get the source code for a WAMP stack installer somewhere? Any help
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
can anyone tell me why this doesn't work? db = openOrCreateDatabase(database.db, SQLiteDatabase.CREATE_IF_NECESSARY, null); db.setLocale(Locale.getDefault());
Can't work out a way to make an array of buttons in android. This
Can we use the asterisk character * for a search action in SQL database?
Can anyone help me trying to find out why this doesn't work. The brushes

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.