Click here to Skip to main content
15,895,084 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
After creating crystal reports in asp.net,C# when i have to go on next page.following error occurs.


No valid report source is available


Plz help me..
Posted
Updated 22-Jul-16 2:51am

#Simple Solution ( although this code is a vb.net code ; but the idea is same and simple )

I have just Solved this problem using CrystalReportViewer **Navigate Event**

in View report Button i have saved report document in a session


VB
Protected Sub Button1_Click(ByVal sender As Object, ByVal e As EventArgs) Handles Button1.Click
       ' -- the ds is dataset variable containing data to be displayed in the report
        
        rptDoc.SetDataSource(ds)
        Session.Add("rptdoc", rptDoc)
        CrystalReportViewer1.ReportSource = rptDoc

        End Sub  

then in Navigate event of CrystalReportViewer i set the CrystalReportViewer data source to the Session
VB
Protected Sub j(ByVal source As Object, ByVal e As CrystalDecisions.Web.NavigateEventArgs) Handles CrystalReportViewer1.Navigate

    rpt.SetDataSource(ds)
    CrystalReportViewer1.ReportSource = session("rptdoc")

End Sub

So each time before you navigate to another page in the report , CrystalReportViewer data source is set to the report document saved in the session.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900