Iuse UpdatePanel for my pages, clients requested to view pages without flickering.
So, I put all component in update panel, but after that, export and printing for Crystal Reports stoped to work. If I put report viewer outside of updatepanel its working.
Have anyone this problem? There's some solution for this?
i donno much abt update panel.. but hope this information might be helpful for u..
Viewstate should be enabled for the page where u r placing viewer..(Enableviewstate= true in page directive).. if its not enabled then print and download options will not work properly..
VMSSanthosh
When you ask a question, remember to click "mark as answered" when you get a reply which answers your question; this ensures the right forum member gets credit below for being helpful (and makes search more relevant too).
I had the same problem. I ended up disabling CrystalReportViewer's toolbars and I created my own button that displayed the report as PDF in new window. And if I remember correctly, the button would have to be outside the update panel and use some JavaScript.
i also did this as klin6on said. when a button clicks a new window will pop up and displays the report in pdf format. if u want like this i'll give you the code....
dim rpt as new reportdocument
rpt.ExportToDisk(ExportFormatType.PortableDocFormat, Server.MapPath("~/Export/Personnel.pdf"))
Dim popupscript As String = "<script language='javascript'>" + "window.open('Export/Personnel.pdf');</script>"
Page.ClientScript.RegisterStartupScript(Me.GetType(), "PopUpWindow", popupscript, False)
I applied the idea of joseabie.
It was a good idea, but there were some issues:
Using the same file path for all reports might conflict with different reports.
Even using different file names will be a problem because then the export directory will keep growing.
How would you like to know with which files are not being used so you can remove them?
Another issue is that the page reloads unnecessarily.
This is how I solved the problem(C#):
I created a page which contains my report which returns report files in an HttpResponse at the page load with the following code:
Then instead of linking the popup script to the click method I used the following code in the load event of the button so I can keep it in the updatepanel:
m24paul
Member
70 Points
18 Posts
Crystal Report Export and Print button not working inside UpdatePanel
Nov 16, 2006 11:33 AM|LINK
Hi
Iuse UpdatePanel for my pages, clients requested to view pages without flickering.
So, I put all component in update panel, but after that, export and printing for Crystal Reports stoped to work. If I put report viewer outside of updatepanel its working.
Have anyone this problem? There's some solution for this?
Thanks, Paul
j.Net
Member
61 Points
41 Posts
Re: Crystal Report Export and Print button not working inside UpdatePanel
Mar 02, 2007 04:18 PM|LINK
vmssanthosh
Participant
970 Points
254 Posts
Re: Crystal Report Export and Print button not working inside UpdatePanel
Mar 03, 2007 06:28 AM|LINK
i donno much abt update panel.. but hope this information might be helpful for u..
Viewstate should be enabled for the page where u r placing viewer..(Enableviewstate= true in page directive).. if its not enabled then print and download options will not work properly..
When you ask a question, remember to click "mark as answered" when you get a reply which answers your question; this ensures the right forum member gets credit below for being helpful (and makes search more relevant too).
deux
Member
2 Points
1 Post
Re: Crystal Report Export and Print button not working inside UpdatePanel
Dec 06, 2007 10:40 PM|LINK
i have same prob and that solution dosnt work
[:)] pls i need help
Jafar2
Member
14 Points
8 Posts
Re: Crystal Report Export and Print button not working inside UpdatePanel
Apr 21, 2008 11:46 AM|LINK
How about using an IFrame?
I had the same problem & solved it using an IFrame.
It might not be the best solution, but it works.
klin6on
Member
372 Points
94 Posts
Re: Crystal Report Export and Print button not working inside UpdatePanel
Apr 21, 2008 09:26 PM|LINK
Hi,
I had the same problem. I ended up disabling CrystalReportViewer's toolbars and I created my own button that displayed the report as PDF in new window. And if I remember correctly, the button would have to be outside the update panel and use some JavaScript.
joseabie
Participant
1165 Points
324 Posts
Re: Crystal Report Export and Print button not working inside UpdatePanel
Apr 22, 2008 05:48 AM|LINK
exactly....
i also did this as klin6on said. when a button clicks a new window will pop up and displays the report in pdf format. if u want like this i'll give you the code....
dim rpt as new reportdocument
rpt.ExportToDisk(ExportFormatType.PortableDocFormat, Server.MapPath("~/Export/Personnel.pdf"))
Dim popupscript As String = "<script language='javascript'>" + "window.open('Export/Personnel.pdf');</script>"
Page.ClientScript.RegisterStartupScript(Me.GetType(), "PopUpWindow", popupscript, False)
Jafar2
Member
14 Points
8 Posts
Re: Crystal Report Export and Print button not working inside UpdatePanel
Apr 22, 2008 08:48 AM|LINK
Hi,
I applied the idea of joseabie.
It was a good idea, but there were some issues:
Using the same file path for all reports might conflict with different reports.
Even using different file names will be a problem because then the export directory will keep growing.
How would you like to know with which files are not being used so you can remove them?
Another issue is that the page reloads unnecessarily.
This is how I solved the problem(C#):
I created a page which contains my report which returns report files in an HttpResponse at the page load with the following code:
PrintPDF.aspx.cs:
ReportDocument rpt = CrystalReportSource1.ReportDocument;
rpt.SetParameterValue("@paramater1", Request.Params["parameter1"]);
rpt.SetParameterValue("@parameter2", Request.Params["parameter2"]);
rpt.ExportToHttpResponse(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat, Response, true, "ReportName");
Then instead of linking the popup script to the click method I used the following code in the load event of the button so I can keep it in the updatepanel:
CrystalReport.aspx.cs:
Button printButton = (Button)sender;string path = PrintPDF.aspx?parameter1=value1¶meter2=value2");
string script = String.Format("window.open('{0}')", path);
printButton.Attributes.Add("onclick", script);
Please let me know if it is not clear.
Jafar
auband
Member
44 Points
56 Posts
Re: Crystal Report Export and Print button not working inside UpdatePanel
Apr 30, 2008 06:52 AM|LINK
I think this is the easiest way (for me at least)
You need two pages, myPage.aspx and OpenFile.aspx
Code extract myPage.aspx
private ReportDocument rd; private void CreateCrystalReport() { rd.SetParameterValue("MyField", "MyValue"); /*export to pdf*/ ExportOptions expo = rd.ExportOptions; expo.ExportDestinationType = ExportDestinationType.DiskFile; expo.ExportFormatType = ExportFormatType.PortableDocFormat; expo.DestinationOptions = new DiskFileDestinationOptions(); string fileName = "report"; string filePath = @"~/tmpStorage/" + fileName; rd.ExportToDisk(ExportFormatType.PortableDocFormat, Server.MapPath(filePath + ".pdf")); Session["reportDocument"] = rd; string script = "<script language='javascript'> window.open('OpenFile.aspx?action=401&filepath=" + filePath + "&filename=" + fileName + "');</script>"; ScriptManager.RegisterStartupScript(this, typeof(myPage), "PopupCP", script, false); }Code extract OpenFile.aspx
-a-
adrianevil
Member
2 Points
1 Post
Re: Crystal Report Export and Print button not working inside UpdatePanel
Jan 21, 2009 01:37 PM|LINK
Crystal Reports Crystal export export to Excel Crystal Reporte crystal reportrt C# crystal report no Print