0

I am trialing jqgrid.net mvc and have noticed that any server error that happens in an add or edit popup dialog, ends up rendering the entire error page in the popup, which is not very pretty. Does anyone know if it is possible to handle this better and perhaps just put a brief message in the dialog instead, a bit like the way validation errors are handled.

4

1 に答える 1

0

errorTextFormatを使用できます。回答と回答にいくつかのコードフラグメントがあります。HTTPエラーメッセージをJSON形式で投稿することをお勧めします。たとえば、ASP.NET MVCの場合は、ここでHandleJsonExceptionAttribute説明されているものを使用できます。重大なコード内の未処理のすべての例外を、デフォルトのHTML応答ではなくJSON応答に変換します。クライアントがサーバー応答でJSON形式を要求した場合にのみ、JSON応答を提供するようにコードを簡単に変更できます。JSON応答は簡単に解析できますが、純粋なHTML応答の場合でも、jQueryセレクターに関して応答の最も重要な部分のみを取得し、コールバックの実装から戻ります。errorTextFormat

于 2012-04-04T22:08:30.117 に答える