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

Export to PDF - Values missing

4 Answers 198 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
George
Top achievements
Rank 1
George asked on 07 Sep 2011, 09:37 PM
When i set some values in code - txt25000.Value = amount25.ToString(); I see these values when I am looking at my report in the report viewer (See attachment) - But when I export/save to a pdf on my computer and open the file up. Any value that is set in code is never displayed.(See second attachment)

any help is appreciated.

4 Answers, 1 is accepted

Sort by
0
Steve
Telerik team
answered on 08 Sep 2011, 09:32 AM
Hi George,

Currently every time the report is previewed, paged or exported through the report viewer it is processed and rendered from scratch. That is why the most probable reason why the values are missing upon export is because they are set in event/method that is not invoked upon export. Set breakpoints and verify if this is indeed the case and if so, move the code to accessible place e.g. the report constructor (after InitializeComponent) or to the Page_Load event if you are setting the values from the calling application. If those values are coming from a database, you might consider using our Table item which is meant exactly for tabular layout and has its own Datasource property which can be accessed through the flexible Report API.

All the best,
Steve
the Telerik team

Thank you for being the most amazing .NET community! Your unfailing support is what helps us charge forward! We'd appreciate your vote for Telerik in this year's DevProConnections Awards. We are competing in mind-blowing 20 categories and every vote counts! VOTE for Telerik NOW >>

0
George
Top achievements
Rank 1
answered on 08 Sep 2011, 04:32 PM
Putting it in the constructor doesnt seem to work - the issue with this seems to be that the report parameters dont seem to get passed in until after this. 

var _raNumber = this.ReportParameters["RANumber"].Value.ToString();

that value is always null.

The second solution you posed - the report doesnt have a page load event - im working in silverlight - so if you were implying that use the page load on my aspx page i dont have access to that.

Any continued help is appreciated, I have a client that needs this done asap.

Thanks
0
George
Top achievements
Rank 1
answered on 08 Sep 2011, 05:17 PM
Found this thread on your site

The NeedDataSource event is meant to be used only for providing data source to the report and that data source is cached unless changed i.e. once cached the NeedDataSource event is not fired again. As you probably know every time the report is previewed, paged or exported through the viewer it is processed and rendered from scratch. During this processing, the cached data source is used, but NeedDataSource is not fired second time. That is why any other changes should be moved to ItemDataBinding event which is fired regardless. 

All the best,
Peter 
the Telerik team

0
Steve
Telerik team
answered on 13 Sep 2011, 11:47 AM
Hi George,

In your original post you did not mention that you use the report parameters for this purpose, on the contrary you gave example with txt25000.Value and that is why one of the suggestions was to use the report constructor. The fact that the report parameters return null in the constructor is expected behavior as they have just been initialized and do not have value yet.
The information in the docs you have found is correct - in case you set item values in NeedDataSource, you should use ItemDataBinding instead.

Kind regards,
Steve
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

Tags
General Discussions
Asked by
George
Top achievements
Rank 1
Answers by
Steve
Telerik team
George
Top achievements
Rank 1
Share this question
or