AnonyMouse
AnonyMouse

Reputation: 18630

jqgrid save method send validation message back to grid

I have a jqgrid in MVC. It has a save method specified as:

editurl: '/Invoice/SaveInvoiceLine/',

public void SaveInvoiceLine(InvoiceLine invoiceLine)
        {
            ...
        }

What I want to do is do some last minute validation in here. There decide whether to save or not. That will be easy enough. The problem is though if I don't decide to save how do I get a validation message back to the grid to show the reason why?

Upvotes: 0

Views: 739

Answers (1)

Oleg
Oleg

Reputation: 221997

You should just use errorfunc parameter of the editRow method. The second parameter of the errorfunc callback function is the response from the server. It's responseText property is the text of the response.

If the server response from the editurl returns any error HTTP code the errorfunc callback function will be called instead of the standard editing processing.

See the answer and this one for additional information.

Upvotes: 1

Related Questions