LinqDataSourceUpdateEventArgs.ExceptionHandled 속성

정의

예외가 처리되었으며 다시 throw되어서는 안 되는지 여부를 나타내는 값을 가져오거나 설정합니다.

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 업데이트 작업 전에 발생 한 유효성 검사 예외를 검사 하는 이벤트입니다. 예외를 처리 하 고 다시 throw 되도록 원하지 않는 경우 설정 합니다 ExceptionHandled 속성을 true입니다. 설정 하지 않으면 경우는 ExceptionHandled 속성을 true, 예외 호출 스택에 있는 다음 이벤트 처리기에 전파 됩니다.

적용 대상