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

Tuesday, July 18, 2006

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 @ 5:49 PM | Feedback (3)
Scott Booth