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

Force RenderReport to return error

3 Answers 62 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Michael Love
Top achievements
Rank 1
Michael Love asked on 16 Mar 2010, 07:03 PM
I have a pdf report that I am creating programmatically behind the scenes and I want to NOT create the report at all if there is no data.

I saw that RenderReport returns a result and I want to know if I can check to see if I get any rows in my NeedDataSource event handler and return and set an error there to have the PDF not be created.

Has anyone addressed a similar issue?

Mike

3 Answers, 1 is accepted

Sort by
0
Michael Love
Top achievements
Rank 1
answered on 16 Mar 2010, 11:29 PM
Actually, a better way is probably to check the data source results prior to rendering the report.

If no rows, then no report.

Anyone have a better idea?
0
Accepted
naphtali davies
Top achievements
Rank 1
answered on 18 Mar 2010, 11:44 AM
  1. I created a ReportBase that inherits from Telerik.Report and added to it a HasData property.
  2. Then I have all my reports inherit from the ReportBase.
  3. When I get the data in the report I check if there is any data, if no I set the property to false and return (without rendering the whole report).
  4. Then after calling the RenderReport I check the HasData property of the report.
0
Michael Love
Top achievements
Rank 1
answered on 02 Apr 2010, 04:26 AM
That is a great idea!

Thanks.
Tags
General Discussions
Asked by
Michael Love
Top achievements
Rank 1
Answers by
Michael Love
Top achievements
Rank 1
naphtali davies
Top achievements
Rank 1
Share this question
or