Eatdoku
Eatdoku

Reputation: 6951

asp.net ObjectDataSource error handling

I have objectdatasource and I am trying to find a way to capture the error that is thrown by the SELECT method.

anyone idea how it can be done?

Page level error handling is preferred, not capturing error at the application_error in global.asax

thanks,

Upvotes: 1

Views: 1216

Answers (1)

Jeroen
Jeroen

Reputation: 4023

Like this:

protected void Page_Load(object sender, EventArgs e)
    {           
        ds.Selected += new ObjectDataSourceStatusEventHandler(ds_Selected);
    }

    void ds_Selected(object sender, ObjectDataSourceStatusEventArgs e)
    {
        if (e.Exception != null)
        {

        }
    }

Upvotes: 6

Related Questions