在我的 WebForms 應用程式中,我有一個包含方法Method_DataBinding和Method_DataBound. 當我用這個 DDL 打開表單并且它有一些錯誤的資料時,它給了我一個例外。我想抓住它,但我不明白,在哪里做。
在方法的最后一行Method_DataBinding沒有錯誤并且它沒有到達Method_DataBound,因此錯誤介于這些方法之間。我不明白在哪里
<asp:DropDownList
ID="SomeId"
runat="server"
DataSourceId="SomeDsId"
OnDataBinding="Method_DataBinding"
OnDataBound="Method_OnDataBound" />
protected void Method_DataBinding()
{
}
// Here betwen this two methods I have error, can't catch it
protected void Method_DataBound()
{
}
uj5u.com熱心網友回復:
如果您使用SqlDataSource(EntityDataSource 類似),您可以使用該Updated事件:
protected void SomeDsId_OnUpdated(object sender, SqlDataSourceStatusEventArgs e)
{
if (e.Exception != null)
{
// handle here
}
}
轉載請註明出處,本文鏈接:https://www.uj5u.com/houduan/381702.html
