One thing I was puzzled over today was that I could see the Exception property of the ObjectDataSourceStatusEventArgs but I could not seem to cast it into the Exception I was expecting. After a little mooching around, and debugging the actual type of the Exception property I found that it is actually of the type:
System.Reflection.TargetInvocationException
Which in turns holds a property called InnerException. This is the Exception property that I needed to cast.
protected void ArticleDataSourceInserted(object sender, ObjectDataSourceStatusEventArgs e)
{
if (e.Exception != null)
{
System.Reflection.TargetInvocationException exc= (System.Reflection.TargetInvocationException)e.Exception;
}
}
Oh and also, make sure that you indicate that the Exception has been handled, assuming that is has ofcourse. This is a boolean property of the ObjectDataSourceStatusEventArgs.
e.ExceptionHandled = true;
Cheers,
Andrew