Blazor export file name

I have set the file name in the export event, but the format seems to be incorrect and it returns what appear to be the ASCII space characters also

ExportName

Not sure what is export event and what format is incorrect. Check our forum FAQ on how to improve your post.

I hope this helps. I am creating a Blazor application and using the Click event in the BUTTON object, I have set the export name to Construction Data ${DateTime.Now} as shown here.

When the application is run and the export button is clicked, the file name shows up with ASCII space chararacters as shown here

ExportName2

The desired export name should be "Construction Data DD/MM/YYY hh:mm:ss

You need to ensure that the characters are valid in a file name.
For example on windows
image

For instance you could use
$"Construction Data {DateTime.Now.ToString("yyyy-MM-dd--HH-mm-ss")}"

Thank you mumfie, your recommendation worked and I was able to format the name correctly!

The filename is passed as a query string parameter which encodes spaces as %20. If you must have spaces in the file name you should consider modifying the export controller implementation and replace the symbols - check the ToExcel method in ExportController.cs.