EntityDataSource.Inserted 事件

定義

發生於在資料來源位置建立新物件之後。

public:
 event EventHandler<System::Web::UI::WebControls::EntityDataSourceChangedEventArgs ^> ^ Inserted;
public event EventHandler<System.Web.UI.WebControls.EntityDataSourceChangedEventArgs> Inserted;
member this.Inserted : EventHandler<System.Web.UI.WebControls.EntityDataSourceChangedEventArgs> 
Public Custom Event Inserted As EventHandler(Of EntityDataSourceChangedEventArgs) 

事件類型

備註

Inserted在資料來源中建立加入的物件時,或當物件資料保存到資料來源時發生錯誤,就會引發 事件。 物件的 Entity 屬性 EntityDataSourceChangedEventArgs 是用來存取新增的物件。

這個物件的屬性包含從資料來源傳回的值,包括任何資料來源產生的值。

如果物件保存到資料來源時發生錯誤, Inserted 就會引發 事件,並將 Exception 物件的 屬性 EntityDataSourceChangedEventArgs 設定為傳 Exception 回的 。 如果您在事件處理常式中 Inserted 處理例外狀況,請將 ExceptionHandled 屬性設定為 true 。 這可防止再次引發例外狀況。 當您為 屬性指定 的值 falseExceptionHandledEntityDataSource 會重新引發例外狀況。

適用於