Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion Groups
DB Engine
SQL ServerMSDESQL Server CE
Services
Analysis (Data Mining)Analysis (OLAP)DTSIntegration ServicesNotification ServicesReporting Services
Programming
CLRConnectivitySQLXML
Other Technologies
ClusteringEnglish QueryFull-Text SearchReplicationService Broker
General
Data WarehousingPerformanceSecuritySetupSQL Server ToolsOther SQL Server Topics
DirectoryUser Groups
Related Topics
MS AccessOther DB ProductsMS Server Products.NET DevelopmentVB DevelopmentJava DevelopmentMore Topics ...

SQL Server Forum / Services / Reporting Services / November 2006

Tip: Looking for answers? Try searching our database.

looping through report items of a rendered report

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Peter Bons - 06 Oct 2006 10:49 GMT
Hi all,

Situation: I have a WinForm application that uses the SQL 2005 reportviewer
component. That reportviewer uses a local report. The report definition
contains a report item (textbox) called "txtEmail" in the table header.
Would it be possible to walk (in runtime!) throught all the report items of
a rendered report so I can get the value of the report item "txtEmail"? I've
tried this code to walk through all the items in a rendered report:

ListControls(reportViewer.Controls);

private static void ListControls(Control.ControlCollection control)

{

   foreach (Control e in control)

   {

           Console.WriteLine(" * " + e.ToString());

           ListControls(e.Controls);

   }

}

but it didn't list the actual report items. I expected to see some output
like " * txtEmail" but that control isn't listed.

Purpose: I have a report that lists a single email address in the table
header. I have overridden the
default export behaviour of the reportviewer so I can render the report to
PDF and mail it to a emailaddress that is available in the rendered report.

Any suggestions of how to accomplish this??
I am using VS2005 with local report attached to a WinForm reportviewer
component.

Kind regards,
Peter
Steve MunLeeuw - 06 Oct 2006 17:22 GMT
In the past I passed a reference of ReportItems to my custom assembly, then
would walk through and grab the values I needed.  For my purposes, turned
out there was a more efficient method with hidden textboxes.  Also I had
some pages with static text and no rows.  Inspecting the ReportItems
collection on these pages would throw an internal error and the report would
fail.  Anyway, here's the code I used:

       static string _SchoolName;

       public string
SchoolName(Microsoft.ReportingServices.ReportProcessing.ReportObjectModel.ReportItems
input)
       {
           string ReturnVal = null;
           try
           {
               Microsoft.ReportingServices.ReportProcessing.ReportObjectModel.ReportItem
rptItemSchoolNameHidden = null;
               rptItemSchoolNameHidden = input["txtSchoolNameHidden"];
               if (rptItemSchoolNameHidden != null)
               {
                   if (rptItemSchoolNameHidden.Value.ToString().Length > 0)
                   {
                       _SchoolName =
rptItemSchoolNameHidden.Value.ToString();
                   }
               }
           }
           catch
           {
               //ignore report item not found error.
           }
           return _SchoolName;
       }

Steve MunLeeuw

> Hi all,
>
[quoted text clipped - 39 lines]
> Kind regards,
> Peter
java2architect@gmail.com - 30 Nov 2006 14:35 GMT
Hi!

Just checking if you managed to solve the problem. I actually wanted to
ask if I could have an embedded code function instead of an external
assembly where in I could access the ReportItems collection for given
"textbox" and loop through all the values.

Thanks in advance for any suggestions.

> In the past I passed a reference of ReportItems to my custom assembly, then
> would walk through and grab the values I needed.  For my purposes, turned
[quoted text clipped - 76 lines]
> > Kind regards,
> > Peter
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.