Skip to Content
0
Former Member
Jul 11, 2014 at 03:01 PM

Print Button Not Working if i not inital the Crystal Report Viewer

140 Views

hiii every body here

i have problem on my web application with framework (4.0)

i use crystal report viewer (crystal report 13) and i installed the engine of crystal report and use dataset as datasource to my report and my report work fine but ....

my problem is :

i cannot export or print my crystal report 13 if i put my code on sub like that :

protected void btn_print_Click ( object sender , EventArgs e )

{

SP_testTableAdapter adpter = new SP_testTableAdapter();

adpter.Fill(ds.SP_test);

Reports.Learning.CrystalReports.CR_testreport my_report = new Reports.Learning.CrystalReports.CR_testreport();

my_report.SetDataSource(ds);

CrystalReportViewer1.ReportSource = my_report;

CrystalReportViewer1.DataBind();

}

when i use this i cannot print or export it say to me login to database fail message although i use dataset not direct database connection that mean it not need to give the report source every use of it the connection of my server details like username , password

but if i put this code to my page load the report run and showing and print correctly , i need to can use print,export and every button on reportviewer toolbar

without put the code that display report on page_load i need to put code on button event only and when i click the button it show the report and can print and export , and not need to use sesssion

need help plz ................