2011-04-05 34 views
3

我有一個使用select事件的業務邏輯對象的數據源。如何捕獲業務邏輯層中發生的異常並將其傳遞到我的表示層以在標籤中向用戶顯示?處理asp.net數據源異常

回答

3

你能趕上數據源例外是這樣的:

protected void SqlDataSource1_Selected(object sender, SqlDataSourceStatusEventArgs e) 
{ 
    if (e.Exception != null) 
    { 
     // do something 
     e.ExceptionHandled = true; 
    } 
} 
+0

人......我是如此接近!我只是想念「e.ExceptionHandled = true;」片!感謝您的快速回復。 – mcass20 2011-04-05 14:54:55