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

Fields in report header not refreshing

2 Answers 172 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Jeff
Top achievements
Rank 1
Jeff asked on 27 Jun 2011, 04:58 PM
I have a report that has a ReportHeader section that has a couple of fields that I set in code - that aren't populated from a DataSource.

That is, in the designer I put aTextBox in the ReportHeader section, and leave it's value blank.

I'm displaying the report on a web page, using the standard Telerik ReportViewer.  The Website is not running with InProc session.

I set the value in onNeedDataSource() to a value I extract from Session[].  (We simply can't run production websites with InProc session state, so these values and the parameters for the queries that populate the DataSources are passed through Session[].)

The report runs fine.  The fields populate correctly, the detail section populates correctly, and the tables in the ReportFooter that have separate DataSources populate correctly.

But when I print, the fields that are set in code are blank.  Same if I export, or even if I simply hit the refresh button in the ReportViewer.

The fields that are being populated from DataSources are set correctly, these fields that are populated directly are left blank.  When I put a breakpoint in onNeedDataSource(), I see that it is not called, when the report refreshes.  It's like the report is working from remembered data, and that the only data it remembers is what is in a DataSource.

Any ideas as to how I can make this work?  Without going to InProc session state - that's simply not a workable solution.

2 Answers, 1 is accepted

Sort by
0
Steve
Telerik team
answered on 30 Jun 2011, 09:17 PM
Hello Jeff,

You should use the ItemDataBinding event for such purpose. As you have correctly noticed, the NeedDataSource event is called only once to get the data source and then it is cached to improve performance. The ItemDataBinding event however would be fired regardless.

Best wishes,
Steve
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Jeff
Top achievements
Rank 1
answered on 01 Jul 2011, 03:21 PM
The field's I was putting in the report header were fixed, they didn't depend on the individual items being reported.

I found that if I set them in the constructor, they're values would stick.
Tags
General Discussions
Asked by
Jeff
Top achievements
Rank 1
Answers by
Steve
Telerik team
Jeff
Top achievements
Rank 1
Share this question
or