Wednesday 8 August 2007

Customising the CrystalReportViewer export button default filename

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" .... />
or programattically:
this.CrystalReportViewer1.ID = "MyReportName";
Otherwise you're into manually coding export functions etc.

No comments :