Creating a DotNetNuke Private Assembly with Crystal Reports - Part 3
page 4 of 5
by Eric Landes
Average Rating: This article has not yet been rated.
Views (Total / Last 10 Days): 22692/ 67

Displaying the Parameters

To display these parameters, we need to instantiate CRParameterPanel and call the method that dynamically creates the controls for each of the parameters.  These controls will hold user input values, then allow the users to view the report based on those parameters.   

The user clicks a select button column on the datagrid with the Text “View.”  This calls the code in Code Listing 2 (from event dg_ReportsList_SelectedIndexChanged) to return the parameters.

Code Listing 2

oPanelClass = new Lancor.CrystalReportManager.CRParameterPanel();

As stated earlier, CRParameterPanel gets instantiated as oPanelClass.  Later, this Panel control gets added to ReportPanel.  This panel control is a container on the user control specifically for displaying the parameters.

The method CreateparamsPanel adds the appropriate controls to the panel for user entry.  This method is based on some code from a previous article, “Automagically Display Crystal Parameters.”  This method assumes that a parameter has Prompting text that is used as a label on the web page. 

This method first checks the Crystal SummaryInfo.Title Property from the Crystal ReportDocument object, and adds that as the title of the report.  We use a label and that label control gets added to the Panel object (oPanelClass).  Once we add the title, then we iterate through the ParameterFields collection in the ReportDocument.DataDefinition.  The object oReport in our code is the instantiation of the ReportDocument.  See Code Listing 3 for a snippet of the code. 

Code Listing 3

crTitle = oReport.SummaryInfo.ReportTitle; 
System.Web.UI.WebControls.Label headingLabel = new
foreach (CrystalDecisions.CrystalReports.Engine.ParameterFieldDefinition
oCRParam in oReport.DataDefinition.ParameterFields) 
  System.Web.UI.WebControls.Label lblNew = new
  lblNew.ID="lbl" +
oCRParam.ParameterFieldName.Trim() + System.Convert.ToString(controlNum).Trim();

We create a label control with the Prompt from the parameter.  Then in further code, we determine the data type of the parameter.  Depending on the data type, we then use custom methods to create a server control which is added to the Panel control after the label. 

Once all the parameters have been iterated through, we will set the View report buttons visible property to true.  This button contains a click event to display the report in the panel.  We will cover that part of the application in Part 4, the final part of this series.

View Entire Article

User Comments

Title: Wrong Source code   
Name: Jesse
Date: 2006-02-07 10:41:45 AM
The source code available here contains no more that a buggy DNN module with only a single form to store a list of files, but nothing about displaying the reports. Wrong version/ manipulation?

Product Spotlight
Product Spotlight 

Community Advice: ASP | SQL | XML | Regular Expressions | Windows

©Copyright 1998-2021  |  Page Processed at 2021-03-05 1:38:48 AM  AspAlliance Recent Articles RSS Feed
About ASPAlliance | Newsgroups | Advertise | Authors | Email Lists | Feedback | Link To Us | Privacy | Search