次の方法で共有


LinqDataSourceUpdateEventArgs.ExceptionHandled プロパティ

定義

例外が既に処理済みで、再度スローする必要がないかどうかを示す値を取得または設定します。

public:
 property bool ExceptionHandled { bool get(); void set(bool value); };
public bool ExceptionHandled { get; set; }
member this.ExceptionHandled : bool with get, set
Public Property ExceptionHandled As Boolean

プロパティ値

例外が処理された場合は true。それ以外の場合は false

次の例は、 イベントのイベント ハンドラーを Updating 示しています。 コントロールを使用して検証例外メッセージが Label 表示されます。

Protected Sub LinqDataSource_Updating(ByVal sender As Object, _
        ByVal e As LinqDataSourceUpdateEventArgs)
    If (e.Exception IsNot Nothing) Then
        For Each innerException As KeyValuePair(Of String, Exception) _
               In e.Exception.InnerExceptions
            Label1.Text &= innerException.Key & ": " & _
                innerException.Value.Message & "<br />"
        Next
        e.ExceptionHandled = True
    End If
End Sub
protected void LinqDataSource_Updating(object sender,
        LinqDataSourceUpdateEventArgs e)
{
    if (e.Exception != null)
    {
        foreach (KeyValuePair<string, Exception> innerException in
             e.Exception.InnerExceptions)
        {
        Label1.Text += innerException.Key + ": " +
            innerException.Value.Message + "<br />";
        }
        e.ExceptionHandled = true;
    }
}

注釈

イベントのイベント ハンドラーを作成して、 Updating 更新操作の前に発生した検証例外を調べることができます。 例外を処理し、再度スローしたくない場合は、 プロパティを ExceptionHandledtrue設定します。 プロパティを ExceptionHandledtrue設定しない場合、例外は呼び出し履歴の次のイベント ハンドラーに反映されます。

適用対象