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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T09:10:21+00:00 2026-06-06T09:10:21+00:00

jqGrid doesn’t send postdata to my controller. I tried all provided solutions on stackoverflow,

  • 0

jqGrid doesn’t send postdata to my controller. I tried all provided solutions on stackoverflow, buy apparently I’m making error(s) somewhere. So here is the code:


     function refreshGrid() {
        alert('CompanyNamePart=' + $("#CompanyNamePart").val()); // to check if this is correct value
        $("#list").trigger('reloadGrid');
        return false;
    }

    $(function () {
        var grid = jQuery("#list").jqGrid({
            datatype: 'json',
            caption: 'Transaction Log',
            postdata: {
                CompanyNamePart: function () { return $("#CompanyNamePart").val(); },
                UsernamePart: function () { return $("#UsernamePart").val(); },
            },
            url: '@Url.Action("GetTransactionLogData")',
            mtype: 'GET',
            colNames: ['Ref.', 'TradeDate', 'Status'],
            colModel: [
                { name: 'Reference', index: 'Reference', width: '60' },
                { name: 'TradeDate', index: 'TradeDate', width: '70' },
                { name: 'Status', index: 'Status', width: '80' }
            ],
            pager: $('#pager'),
            rowNum: 10,
            height: '100%'
        });
    });


On Controller side I have simple code:

[HttpGet]
        public ActionResult GetTransactionLogData(string sidx, string sord, int page, int rows,  string CompanyNamePart, string UsernamePart)
        { return Json(null); }

and in Debugging mode when I call refreshGrid() by clicking a button I get one alert to confirm me that it reads correctly value of textfield, and after that it refreshes the grid. I receive call of controller, but values for CompanyNamePart and UsernamePart variables are all null, even though I filled them.

I tried another solution for postdata section with another approach, first I created functions that return needed values and put them in postdata section of grid:

    function getCompanyNamePartVal() {
        return $("#CompanyNamePart").val();
    }

    function getUsernamePartVal() {
        return $("#UsernamePart").val();
    }

... in jqgrid definition
    postdata: {
                CompanyNamePart: getCompanyNamePartVal(),
                UsernamePart: getUsernamePartVal(),
            },

but with no success.

When I checked Firebug, I could see that jqGrid is not sending postdata values:

Get Parameters caught by Firebug
_   1340696638960
_search false
nd  1340696638955
page    1
rows    10
sidx    
sord    asc

What am I doing wrong?

  • 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-06T09:10:22+00:00Added an answer on June 6, 2026 at 9:10 am

    The parameter is called postData, not postdata. Don’t forget that javascript is a case sensitive language. So try like this:

    postData: {
        CompanyNamePart: function () { return $("#CompanyNamePart").val(); },
        UsernamePart: function () { return $("#UsernamePart").val(); }
    }
    

    Also notice that I removed a trailing comma after the UsernamePart function that you had in your code and which produces invalid javascript. Some more sensitive browsers might not accept it.

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

Sidebar

Related Questions

Why doesn't resizeStop get called after I resize a jqgrid table? Here is my
I'm trying to use jqGrid, but it doesn't respect the imgpath, it always defaults
Is is correct that jqGrid doesn't currently contain an inline add. I'm trying to
I'm trying to implement a simple function using jqGrid, but it doesn't seem to
I have a JQGRid tree. It loads data click by click, not all at
I have a page with a jstree and/or jqgrid - it really doesn't matter
I have a jqGrid where I want all the rows to be in edit
Does jqGrid just have any callback after single field search? The onSearch callback fires
I'm trying to set format for time in a jqGrid. It does not work.
With jqGrid if width of columns are not specified, they share the width of

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.