Click here to Skip to main content
15,908,675 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I am using crystal reports for visual studio 2010. In a website I developed a report which get displayed on a button click through crystal report viewer. When I try to export using export button by default it shows name or ID of my crystal report viewer For e.g. My name of Crystal report viewer Control is Reportviewer it displays name as Reportviwer.pdf or .xls. I want to set name dynamically how can I achieve this? Thanks in advance

ReportDocument cryRpt = new ReportDocument();

string report = "reportLocation";


CrystalReportViewer1.ReportSource = cryRpt;
Updated 16-Jun-13 23:53pm
sanchit patne 17-Jun-13 1:50am    
Can you post a part of your code.?
Member 11935190 5-Dec-15 4:03am    
I have same problem now and i searched a lot but i didn't find solution so could you fix your issue ?

Please set "ReportViewer.LocalReport.DisplayName" property with dynamically name and test. Hope it will help.
Share this answer
Madhav Hatwalne 17-Jun-13 5:49am    
I am unable to find such property!
Mahesh Bailwal 17-Jun-13 6:08am    
Sorry. I have given you wrong property name used for RDLC report viewer. May be below link will help you
Madhav Hatwalne 17-Jun-13 6:10am    
Thank you very much for your effort plz do me a favor can you paste property here i m unable to open that link
Mahesh Bailwal 17-Jun-13 6:17am    
Below I have pasted the content of link. Basically you need to change ID of CrystalReportViewer dynamically.

Crystal Reports is generally pretty useful, it's a shame some of the more common development tasks have not been exemplified by the creators. It's easy to think many things simply aren't possible, but with a bit of research you soon find most things are.

Setting the default filename used by the CrystalReportViewer web control is one of those things. The filename used defaults to the ID property of the viewer control, so to change it simply change the ID. You can do this declaratively:

<cr:crystalreportviewer id="MyReportName" ....="" xmlns:cr="#unknown">
or programattically:
this.CrystalReportViewer1.ID = "MyReportName";
Otherwise you're into manually coding export functions etc.
Madhav Hatwalne 18-Jun-13 0:56am    
But in this solution i have to reset control name
I disabled the export button of crystal report viewer and exported using ExportHttpResponse
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