This is my code for crystal report bind, i have dropdown list that value am passing as parameter. I have search button on click that i displayed the report. Its working fine.
But when i click print button , it shows the report requires further information.
<CR:CrystalReportViewer ID="OrderOutStandingReportStatus" runat="server" ReuseParameterValuesOnRefresh="True" AutoDataBind="true" ToolPanelView="None" Visible="False" DisplayGroupTree="False" Height="799px" ReportSourceID="CrystalReportSource4" Width="1013px" /><CR:CrystalReportSource ID="CrystalReportSource4" runat="server"><Report FileName="OrderStatusWPSS.rpt"><Parameters><CR:ControlParameter ControlID="DrpOrderStatus" ConvertEmptyStringToNull="False" DefaultValue="" Name="Status" PropertyName="SelectedValue" ReportName="" /></Parameters></Report></CR:CrystalReportSource>
My code behind : protected void BtnSearchStatus_Click(object sender, EventArgs e) { ReportDocument reportDocument = new ReportDocument(); OrderOutStandingReportStatus.ReuseParameterValuesOnRefresh = true; string Server12 = ConfigurationManager.AppSettings["Server"]; string user = ConfigurationManager.AppSettings["Userid"]; string Password = ConfigurationManager.AppSettings["Password"]; string DataBase12 = ConfigurationManager.AppSettings["DataBase"]; reportDocument.Load(Server.MapPath("OrderStatusWPSS.rpt")); reportDocument.SetParameterValue("Status", DrpOrderStatus.SelectedValue); Session["OORStatus"] = reportDocument; crConnectionInfo.ServerName = Server12; crConnectionInfo.DatabaseName = DataBase12; crConnectionInfo.UserID = user; crConnectionInfo.Password = Password; crDatabase = reportDocument.Database; crTables = crDatabase.Tables; foreach (CrystalDecisions.CrystalReports.Engine.Table crTable in crTables) { crTableLogOnInfo = crTable.LogOnInfo; crTableLogOnInfo.ConnectionInfo = crConnectionInfo; crTable.ApplyLogOnInfo(crTableLogOnInfo); //crTable.Location = crConnectionInfo.DatabaseName + ".dbo." + crTable.Location.Substring(crTable.Location.LastIndexOf(".") + 1); } OrderOutStandingReportStatus.ReportSource = reportDocument; OrderOutStandingReportStatus.RefreshReport(); OrderOutStandingReportStatus.Visible = true; }