This is a migrated thread and some comments may be shown as answers.

Redirect On Error

1 Answer 57 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Marcus Kellermann
Top achievements
Rank 1
Marcus Kellermann asked on 02 Nov 2011, 04:12 PM
Using the Web Report Viewer how can one redirect the client to an error page when there is an error processing the report?

In order to help stem performance issues from users running reports that result in to large of a data set (20,000+ records).  We throw an exception in the reports NeedDatasource event.   However since reports aren't run in the context of the page (their run from the report handler) the exception doesn't bubble up to a level that we can redirect at the server level.

Is there a way of handling the error on the client and redirecting.

Using the message value of the exception I can display a "useful" error message to the user since the report view displays the Exception.Error message.   However i'd prefer to redirect them to a more meaningful page.

If not is there a way to localize the "An error has occurred while processing Report"   Text? 

1 Answer, 1 is accepted

Sort by
0
Peter
Telerik team
answered on 04 Nov 2011, 04:44 PM
Hi Marcus Kellermann,

You are correct the HTTP Handler is responsible for serving reports to the web report viewer. Thus you can't redirect the page whenever there is report processing error. Still you can get the users culture in the report's NeedDatasource and localize the error message as shown in the following code snippet:

if(System.Threading.Thread.CurrentThread.CurrentCulture.Name == "bg-BG")
    throw new Exception("Error in Bulgarian");
else
    throw new Exception("Error in English");
Greetings,
Peter
the Telerik team

Q2’11 SP1 of Telerik Reporting is available for download (see what's new). Get it today.

Tags
General Discussions
Asked by
Marcus Kellermann
Top achievements
Rank 1
Answers by
Peter
Telerik team
Share this question
or