JqGrid: postData is not dispatched to controller action during inline edit

I have a jqGrid in 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 the jqGrid method , when I do inline row editing .

I am using the postData attribute of the jqGrid for this:

JavaScript:

$('#tblLines').jqGrid({

    ...

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

    ...

    }

      

MVC:

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

      

The problem is it doesn't receive messages during POST, which jqGrid does for the controller for the editUrl. My string values ​​make it up, but the last parameter, MyId, is always zero. I checked Firebug and confirmed that POST only sends the first two values.

Any ideas? Is it possible to post postData values ​​while editing in a grid in a row?

+2


source to share


5 answers


Unfortunately, there was no clean way to do this with a grid. I ended up storing the value needed for the session, not a hidden field, so I could get it on the back for free.



+1


source


Using:



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

      

+3


source


I don't think it is. postData is sent when posts are retrieved. My wild guess is that you have to handle the beforeSubmitCell and manipulate the object that will be presented there.

+1


source


I had some bad experience to get this to actually work. My workaround (which luckily was taken as a legitimate UI approach) was to ensure that buttons are retained and canceled on row selection.

The saveRow method for jqGrid allows you to enter row-specific data to publish. I would suggest looking into this one.

0


source


There is something we call postData, you can manipulate it on the client and send user data to the server as URL Get parameters, for example.

I think I can see something here on stackoverflow that should work:

jqgrid userData sends null on update

On the side of the note, we (Trirand guys behind jqGrid) are now working on an ASP.NET WebForms and MVC site with examples and even a standalone ASP.NET server side component (similar to a GridView) that will work with almost no code with jqGrid ...

You can view the Alpha of our work here: jqgrid userData sending null on update

0


source







All Articles