jqGrid: postData not being posted to controller action during in-line edit

14,420

Solution 1

Unfortunately there was no clean way to do this with the grid. I ended up storing the value needed in Session rather than a hidden field, so I could then access it on the back end for free.

Solution 2

Use :

postData: {MyId :function() { return $('#MyId').val();}

Solution 3

I don't think it's supposed to. postData is sent when fetching records. My wild guess is that you should handle beforeSubmitCell instead and manipulate the object to be submitted there.

Share:
14,420

Related videos on Youtube

The Matt
Author by

The Matt

Open Source Projects: CruiseControlNET Plugin to publish build results to Amazon S3: http://code.google.com/p/ccnet-s3-publisher/

Updated on June 04, 2022

Comments

  • The Matt
    The Matt almost 2 years

    I have a jqGrid on an ASP.Net MVC view. I want to use to pass the value of a hidden text control on the page as an additional parameter to a jqGrid method, when I'm making an in-line edit to a row.

    I'm using the postData attribute on jqGrid to do this:

    Javascript:

    $('#tblLines').jqGrid({
    
        ...
    
        postData: {MyId : $('#MyId').val()}
    
        ...
    
        }
    

    MVC:

    public ViewResult EditModifyLine(string id, string quantity, string MyId)
    

    The problem is it's not getting posted to during the POST that jqGrid makes to the controller for the editUrl. My row values are making it up, but the last parameter MyId is always null. I've checked Firebug and confirmed that the POST is sending up only the first two values.

    Any ideas? Is it possible to send up the postData values during an in-line edit on a grid?

  • The Matt
    The Matt over 14 years
    Excellent, thanks for the response. I'll look forward to that.