Last post Mar 23, 2011 07:38 AM by Archetti
Mar 14, 2011 03:45 AM|Archetti|LINK
I defined a report with a parameter (ID_Aluno) in Crystal Reports to show it in an .aspx page. The page is called by another page passing it a query string with the value I need as a parameter in the report. In the code behind file I tryed three different
approches without success. What happen is that the report is showed without data, but when I open the parameter panel I see that the parameter is there (If I don't set the parameter value actually it complains that the parameter is missing, giving an arror).
Here is the code I used to set the parameter:
Private Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Dim ID_Aluno = (Request.QueryString("CodAluno"))
'Dim report As New ReportDocument
'report.FileName = (Server.MapPath("~/reports/HistorialAluno.rpt"))
'CrystalReportViewer1.ReportSource = report
'Dim Parameters As New ParameterFields
'Dim Parameter As New ParameterField
'Dim ParamValue As New ParameterDiscreteValue
'Parameter.Name = "ID_Aluno"
'ParamValue.Value = (Request.QueryString("CodAluno"))
'CrystalReportViewer1.ParameterFieldInfo = Parameters
The First try (code not commented) is the one I would like to use because it is the shorter and simpler one.
Here is the mark up for the report source and report viewer:
<CR:CrystalReportViewer ID="CrystalReportViewer1" runat="server" AutoDataBind="true"
EnableDatabaseLogonPrompt="False" EnableParameterPrompt="False" ToolPanelView="None"
PageZoomFactor="90" ReportSourceID="CrystalReportSource1" />
<CR:CrystalReportSource ID="CrystalReportSource1" runat="server">
Have I to declare or define something special in Crystal Reports for the parameter to be received and applied?
Mar 22, 2011 03:55 AM|microsoftee|LINK
Use a hidden control and set its value in Page_load event and set parameter in ReportSource control to that hidden control.
Mar 23, 2011 07:38 AM|Archetti|LINK
As I posted the same problem to Business Intelligence Crystal Reports forum and it has been solved, here is the post in that forum: