Your code is running
on the server. You are exporting the report to a file
on the server.
If you want the Excel file to be saved
on the client, then you have to write the file to the
Response
. The user will then be able to choose where to save it.
Rather than using
ExportToDisk
, use
the ExportToHttpResponse
method[
^]:
if (_dt.Rows.Count > 0)
{
FileName = FileName + ".xls";
rep_doc.Load(FilePath);
rep_doc.Refresh();
rep_doc.SetDataSource(_dt);
rep_doc.SetParameterValue("FromDate", txtFromDate.Text.Trim());
rep_doc.SetParameterValue("ToDate", txtToDate.Text.Trim());
rep_doc.ExportToHttpResponse(CrystalDecisions.Shared.ExportFormatType.Excel, Response, true, FileName);
}