This topic is locked
[SOLVED]

How to add the current date to the exported file name?

11/12/2026 10:17:44
ASPRunner.NET General questions
M
max benelli author

Hello,
I use ASPRunner.NET (not PHPRunner), and I would like the exported file of my table admin_users to have the current date in its name, for example admin_users_22_10_2026.csv or admin_users_22_10_2026.xlsx.
In the forum I received an answer with PHP code (date() and header('Content-Disposition...') in the “Export page: Before process” event), but it does not apply to the .NET version.
I tried this C# code in the “Export page: Before process” event:
csharp

string data = DateTime.Now.ToString("dd_MM_yyyy");
string nomeFile = "admin_users_" + data + ".csv";
MVCFunctions.Header("Content-Disposition", "attachment; filename=\"" + nomeFile + "\"");

The result:
• CSV: the file gets the right name, but its content is not the user data. It contains the internal JSON response of the export page ({"success":true,"pagesData":{...).
• XLSX: nothing is downloaded at all.
It seems that this event runs during the AJAX request, not during the real file download.
Could you please tell me in which event (or in which file/template) I should set the file name for CSV and Excel exports in ASPRunner.NET, and give me the exact C# code to use?
Thank you very much.

Sergey Kornilov admin 11/16/2026

This is something that is not possible in ASPRunner.NET without source code modification. Cannot be done with the help of events.

C
Chris Whitehead 11/18/2026

I think the soultion you're left with is creating a custom button, select all the records, then write your own csv export, I don't know how to do this in .net but maybe ask AI.

Sergey Kornilov admin 11/18/2026

We'll see if we can add this functionality in version 11.4

M
max benelli author 11/18/2026

ok