Open cuongbk81 opened 8 years ago
Hi, I also would like to modify the generated filename.
I managed to do it like like this in ReportViewerExtensions.cs :
In SetupLocalProcessing :
if (parameters?.ControlSettings?.DisplayName != null) localReport.DisplayName = parameters.ControlSettings.DisplayName;
In SetupRemoteProcessing :
if (parameters?.ControlSettings?.DisplayName != null) serverReport.DisplayName = parameters.ControlSettings.DisplayName;
And in ControlSettings.cs :
public string DisplayName { get; set; }
Could you add it to the next NuGet package? Thanks
I also would like to have a different report name when user clicks on export button. How could i do that?
I do not think you can change the report name whn uer clicks export button. This is the part of the original report viewer web control.
Could you send me a pull request for the proposed features, please?
It is possible to change the report file name through JavaScript. I'm currently using this because of the missing DisplayName property in 0.8.3. This is kind of a hack. I'm looking forward to have the DisplayName property in 0.8.4
Thanks Sven
I use mvcreportviewer for my solution, i config as:
@Html.MvcReportViewerFluent("App_Data/Report/TestReport.rdlc").ProcessingMode(ProcessingMode.Local).ReportParameters(new { ReportName = Model.ReportName, Province = Model.Province }).LocalDataSource("TestDataset", Model.Data).ControlSettings(settings).Attributes(new { Height = 750, Width = "100%", style = "border: none" })
I want use default export button of viewer and i want to change export filename with timestamp. Now, export filename is "TestReport", that isn't meaning. Please help me!
P/s: i don't want to create new action Excel Download as:
private ActionResult DownloadReport(ReportFormat format, bool isLocalReport, string filename = null) { if (isLocalReport) { return this.Report( format, LocalReportName, new { Parameter1 = "Test", Parameter2 = 123 }, ProcessingMode.Local, new Dictionary<string, DataTable> { { "Products", LocalData.GetProducts() }, { "Cities", LocalData.GetCities() } }, filename); }