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

trap runtime error

8 Answers 100 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Michael
Top achievements
Rank 1
Michael asked on 21 Aug 2008, 09:02 PM
Is there a way to trap a runtime error on a field so I can replace the field value with just "Error" instead of that big error msg that shows up by default.

8 Answers, 1 is accepted

Sort by
0
Steve
Telerik team
answered on 22 Aug 2008, 09:04 AM
Hi Michael,

We believe that we provide comprehensive enough error messages, so that you can figure out what is wrong with your report data. Is there any reason why you would like to show a generic error msg instead of trying to handle the error so that it does not occur?
Anyway, you can handle it as you would normally do yourself by hooking up to the ItemDataBound event of the specific field you work with.

Best wishes,
Steve
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Michael
Top achievements
Rank 1
answered on 22 Aug 2008, 02:26 PM
The error msg is fine. I just want to limit it to a smaller amount of text so the end user sees something simple. For instance, I am loading images into a report and if the image is not available I just want to display an 'N/A' instead of:
#ERROR# Could not find file 'C:\Development\MediaMasterLive\MyoohMedia\UploadThumb\59\267\311.bmp'.

I put a breakpoint in the ItemDatabound event, but the code never breaks there when I preview. Are breakpoints not honored when you preview? Do I have to run the app and then the report to hit the breakpoint?

 Thanks
0
Steve
Telerik team
answered on 22 Aug 2008, 03:19 PM
Hi Michael,

There is an easier way to achieve what you want. Instead of trying to manually handle the error, you can simply use one of the built-in functions to help you do that i.e.:

=IIf(Fields.MyImage <> "", Fields.MyImage, "N/A")

Of course the check in your case might be different, depending on what is returned from your database.

Kind regards,
Steve
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Michael
Top achievements
Rank 1
answered on 22 Aug 2008, 03:50 PM
The database returns the path to the image, but the image file is not there so the picturebox cannot load the image and the error message is displayed.

0
Steve
Telerik team
answered on 25 Aug 2008, 02:39 PM
Hi Michael,

In this case the easiest way to handle such scenario would be to create a user function, and implement your logic that checks if the provided path returns and image and if not show N/A. Then you can use the function in your report definition item like this:

=MyUserFunction(
Fields.MyImage)

Kind regards,
Steve
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Jeremy Mann
Top achievements
Rank 1
answered on 29 Sep 2009, 05:43 PM
I'm having the same issue as Michael. 

Seems silly to have to create a function that requires disc IO just to workaround a Telerik error message not to mention this is pre databinding and not a fool proof way to prevent the current error.  The suggestion means the pictureBox does a double disc IO hit for each PictureBox; once to check its there, and the other to grab it. 

I'd like to just test for the error and handle it in my own way AFTER or WHEN the telerik pictureBox errors.  Is there a way to test or override the error?  Perhaps using the ItemDataBound event and detect the error?  I would rather trap and have visible=false; or set some default image then display the nasty looking message that's currently present when an image file is missing from the server. 
0
Steve
Telerik team
answered on 30 Sep 2009, 11:09 AM
Hello Jeremy,

In Q2 2009 we've implemented processing error handling, which can be used for this purpose.

Best wishes,
Steve
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
john81
Top achievements
Rank 1
answered on 18 Jan 2010, 09:14 PM
I'm having the same issue with images.  I'm returning the image using a url but not all images will be present so I'd like a way to not show the error box.  Do you have an example of processing error handling so that I can trap a 404 not found error in my picture box and not have the error box displayed?
Tags
General Discussions
Asked by
Michael
Top achievements
Rank 1
Answers by
Steve
Telerik team
Michael
Top achievements
Rank 1
Jeremy Mann
Top achievements
Rank 1
john81
Top achievements
Rank 1
Share this question
or