I have created a report using crystal reports. I am using visual studio 2010. The problem occurs when I try to go to another page. When I try to navigate to page 2 or last page the error No valid report source is available appears on the screen. Does anyone have any idea what I need to do? Thanks for your time
A report might be blank or missing data if the wrong fields are being used, the wrong criteria is in the Select Expert, or the table joins are not set to Left Outer Join.
The Standard and Professional editions were discontinued with the release of SAP Crystal Reports 2008. SAP Crystal Reports Xi Developer edition remains available and does everything that Standard and Pro could do - and more.
Store you report in Session and then give report source from session on page post back
protected void Page_Load(object sender, EventArgs e)
{
if (IsPostBack)
{
try
{
CrystalReportViewer1.ReportSource = (ReportDocument)Session["Report"];
CrystalReportViewer1.RefreshReport();
CrystalReportViewer1.DataBind();
}
catch (Exception ex)
{
// throw;
}
}
}
protected void CrystalReportViewer1_PreRender(object sender, EventArgs e)
{
}
protected void btnPrint_Click(object sender, EventArgs e)
{
ReportDocument rptDoc = new ReportDocument();
rptDoc.Load(Server.MapPath("Reports\\BalanceReportNew\\BalanceReport.rpt"));
rptDoc.SetDataSource(ReportData());
Session["Report"] = rptDoc;
CrystalReportViewer1.ReportSource = rptDoc;
CrystalReportViewer1.RefreshReport();
CrystalReportViewer1.DataBind();
}
public DataTable ReportData()
{
string ClassName = ddlClass.SelectedValue;
string Division = ddlDivison.SelectedValue;
string Subject = ddlSubjects.SelectedValue;
DataTable ReportData = objRpt.getReportData(ClassName, Division, Subject);
return ReportData;
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With