Wrox Programmer Forums
|
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 software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old September 10th, 2006, 08:52 PM
Registered User
 
Join Date: Sep 2006
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,

 
Old September 10th, 2006, 09:00 PM
Registered User
 
Join Date: Sep 2006
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

oops, transcription error...

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

 
Old July 21st, 2008, 07:10 PM
Registered User
 
Join Date: Jul 2008
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





Similar Threads
Thread Thread Starter Forum Replies Last Post
Locking Header and/or Footer x_ray Word VBA 1 January 2nd, 2007 01: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 06:22 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.