سؤال

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?

هل كانت مفيدة؟

المحلول

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.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top