Scott Booth's Blog
My Links
Blog Stats
  • Posts - 5
  • Stories - 0
  • Comments - 10
  • Trackbacks - 0
Archives

Needing to add values from your database to the page header or footer is pretty common in reports.  Everything I've found to date has said that in Asp.Net 2.0 local reporting services, you could not add any values from your data set to the page header or footer.  The data set values can only be used within the body.  This statement is true.  However, you can use the “value” from a control in your report in the page header or footer. 

So if you have a textbox in the body of the report that stores a value from your data set, you can add a textbox (or any control) to the header, and type =First(ReportItems!Customer.Value)“ in the expression for this textbox.  The “ReportItems“ part of the expression tells the report to find the control called “Customer“ and retrieve the first value in it. 

It's important to note that “Customer“ is the name of my textbox control in the body.  Not the name of the field from the data set. You could also use “Last“ in the expression to return the last value instead of the first.  With this expression, the customer name that is in the textbox will be printed in the header of the report. 

posted on Tuesday, July 18, 2006 5:49 PM
Feedback
  • # re: Adding Values From Data Set to Page Headers/Footers in Reports ASP.Net 2.0
    furmangg
    Posted @ 7/24/2006 5:48 PM
    If I remember correctly, the textbox in the body has to appear on every page. If it's only on the first page, then I think the header textbox will show up blank on all subsequent pages. (Whether I'm right or not, it's worth double checking, at least. I know that's the way it works when rendering a Reporting Services report in Report Manager, at least.)
  • # re: Adding Values From Data Set to Page Headers/Footers in Reports ASP.Net 2.0
    mike
    Posted @ 7/26/2006 11:13 AM
    When I export to pdf, it disappears from the page header. What's up with that?

    Thanks!
  • # re: Adding Values From Data Set to Page Headers/Footers in Reports ASP.Net 2.0
    Mark H
    Posted @ 9/20/2007 12:43 PM
    found a better way
    Just create a report parameter then at runtime assign whatever to the report params then you can use Parameter!ParamName.Value in the Page Header or Footer and It repeats across all pages!!!
Title  
Name  
Url
Comments   
Protected by Clearscreen.SharpHIPIn order to prevent spam, please enter the code to post a comment.:
Scott Booth