LinqDataSourceUpdateEventArgs.Exception プロパティ

定義

更新操作の前に行われていたデータ検証中にスローされた例外を取得します。

public:
 property System::Web::UI::WebControls::LinqDataSourceValidationException ^ Exception { System::Web::UI::WebControls::LinqDataSourceValidationException ^ get(); };
public System.Web.UI.WebControls.LinqDataSourceValidationException Exception { get; }
member this.Exception : System.Web.UI.WebControls.LinqDataSourceValidationException
Public ReadOnly Property Exception As LinqDataSourceValidationException

プロパティ値

エラーが発生した場合は例外。それ以外の場合は null

次の例は、 イベントのイベント ハンドラーを 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;  
    }  
}  

注釈

更新操作が実行される前に検証例外が発生した場合、例外は プロパティに Exception 格納されます。 イベントのイベント ハンドラー Updating では、 プロパティを使用して例外を Exception 取得できます。

適用対象