在我的WebForms应用程序中,我有一个下拉列表(DDL),其中包含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()
{
}发布于 2021-12-12 09:56:24
如果使用SqlDataSource(EntityDataSource similar),则可以使用Updated event
protected void SomeDsId_OnUpdated(object sender, SqlDataSourceStatusEventArgs e)
{
if (e.Exception != null)
{
// handle here
}
}https://stackoverflow.com/questions/70322387
复制相似问题