jqgrid error Status: 'error'. Error code: 500 on add
Ok, I know there are already questions on here about this but none are giving me an answer.
I'm using jqgrid in MVC. In my View I have set up a jqgrid:
jQuery(document).ready(function () {
var invoiceId = @Model.Invoice.InvoiceId;
jQuery("#list").jqGrid({
url: '/Invoice/InvoiceLineGridData/' + invoiceId,
....
editurl: '/Invoice/SaveInvoiceLine/' +开发者_如何学编程 invoiceId,
...
});
So my jqgrid is a list of invoiceLines
that relate to an invoice
. The edit works fine but when I try to do an add I get error Status: 'error'. Error code: 500.
The method it's calling on the controller is like:
public void SaveInvoiceLine(InvoiceLine invoiceLine, int id)
{
...
}
So what's causing the error on the add is it's trying to assign a null
to id
. I don't want to make the id nullable because it never will (should) be.
I've found the issue isn't with: var invoiceId = @Model.Invoice.InvoiceId;
as I for an experiment changed to editurl: '/Invoice/SaveInvoiceLine/2',
Even with this hardcoded on add I'm still getting the error with it coming through nullable.
Any suggestions on how to fix this?
This did it:
http://blog.palelocust.com/?p=52
精彩评论