我无法处理SqlDataSource的异常。我的ListView当前正在使用SqlDataSource。我的代码似乎没有显示错误消息,即使它对我来说是正确的。我似乎无法确定错误。
代码:
protected void CustomerSQLDataSource_Selected(object sender, SqlDataSourceStatusEventArgs e)
{
if (e.Exception != null)
{
//Show error message
string myStringVariable = "Error";
ScriptManager.RegisterStartupScript(Page, this.GetType(), "myalert", "alert('" + myStringVariable + "');", true);
//Set the exception handled property
e.ExceptionHandled = true;
}
}