Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
BOOK: Professional SQL Server 2005 Reporting Services ISBN: 0-7645-8497-9
This is the forum to discuss the Wrox book Professional SQL Server 2005 Reporting Services by Paul Turley, Todd Bryant, James Counihan, Dave DuVarney; ISBN: 9780764584978
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Professional SQL Server 2005 Reporting Services ISBN: 0-7645-8497-9 section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
 
 
Thread Tools Display Modes
  #11 (permalink)  
Old September 10th, 2006, 08:52 PM
Registered User
 
Join Date: Sep 2006
Location: , , .
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

The data is processed seperately from the rendering of the report. ReportItems collection items have individual scopes and kludges in which fields are forced to repeat across pages can be used to set header/footer fields on those pages. Besides the ReportItems collection, Globals and Parameters can also be used to set header/footer field content. In a local report, parameter values may not be set to Field values. However, the ReportViewer webcontrol exposes the report's Parameters. Therefore, you can set the report parameters by using the ReportViewer's LocalReport SetParameters method. A couple of code behind examples:

    ' the first report parameter from a DropDownList
    Dim selectedItem As String = Me.DropDownList1.SelectedValue

    ' the second report parameter from an ObjectDataSource DataView DataRow Item
    ' (that is; a field)
    Dim irow As Integer = 0
    Dim icol As Integer = 0
    Dim activeView As System.Data.DataView = Me.ObjectDataSource2.Select()
    Dim cellItem As String = activeView.(irow)(icol).ToString()

    ' set the ReportViewer's parameters (same as the parameters defined in the report's .rdlc)
    Dim params(1) As Microsoft.Reporting.WebForms.ReportParameter
    param(0) = New Microsoft.Reporting.WebForms.ReportParameter("rpti d", selectedItem)
    param(1) = New Microsoft.Reporting.WebForms.ReportParameter("rptg rp", cellItem)
    Me.ReportViewer1.LocalReport.SetParameters(params)
    ' create the new report
    Me.ReportViewer1.DataBind()
    Me.ReportViewer1.LocalReport.Refersh()

A report with header or footer fields contents set to the report parameter values will display these on each page.

Cheers,

  #12 (permalink)  
Old September 10th, 2006, 09:00 PM
Registered User
 
Join Date: Sep 2006
Location: , , .
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

oops, transcription error...

    params(0) = ...
    params(1) = ...

  #13 (permalink)  
Old July 21st, 2008, 07:10 PM
Registered User
 
Join Date: Jul 2008
Location: , , .
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I have multi-page lists-within-lists and it only shows the correct value on the first page heading of the report - in my case a Period End date that is the same for all records. I used the following trick to save the value (in this case a date field) for subsequent page headings:
A)
In Report - Properties - Code
   Public Function StoreFirstValue_PeriodEndDateFromExtract(aDT as DateTime) as DateTime
        Static dtPeriodEndDateFromExtract as DateTime
        if dtPeriodEndDateFromExtract.Year < 999 then
            dtPeriodEndDateFromExtract = aDT
        end if
        return dtPeriodEndDateFromExtract
    End Function
B)
the text box uses the following expression:
="Period Ending " & Code.StoreFirstValue_PeriodEndDateFromExtract(CDat e(First(ReportItems("textboxPeriodEndDateFromExtra ct").Value))).ToString("d MMMM yyyy")

HTH
Brewmanz
 


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Locking Header and/or Footer x_ray Word VBA 1 January 2nd, 2007 12:02 AM
HOw can i add Header and footer? NinaWilliam ASP.NET 1.0 and 1.1 Basics 0 April 25th, 2006 04:22 AM
header footer zaman1111 JSP Basics 0 July 28th, 2005 05:00 PM
addin a header and footer rom XSLT 0 July 28th, 2005 03:24 AM
Regarding Word header and footer Hari_Word General .NET 0 November 19th, 2004 05:22 AM



All times are GMT -4. The time now is 11:32 AM.


Powered by vBulletin®
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.