Jul 19, 2021, 12:00 PM
[CLOSED] Download File via DirectEvent
How would a file download that is initiated via a DirectEvent work in Ext.NET v7?
This forum post explains how it worked in a previous version. I can't find any 'IsUpload' property for a click event handler in v7 though. I assume things have changed somewhat in the framework since that post was written.
In the code-behind of a Razor page, I want to create a button that, when clicked, will invoke a Direct Event for the page. Something like this:
Paul
This forum post explains how it worked in a previous version. I can't find any 'IsUpload' property for a click event handler in v7 though. I assume things have changed somewhat in the framework since that post was written.
In the code-behind of a Razor page, I want to create a button that, when clicked, will invoke a Direct Event for the page. Something like this:
new Button
{
Text = "Export",
DirectEvents =
{
new ClickDirectEventHandler
{
Url = "ExportToExcel", // How to set page handler instead?
ExtraParams =
{
new DirectEventParameter
{
Key = "TabName",
Value = tabName
}
}
}
}
}
The handler for the Direct Event looks something like this: [Direct]
public async Task<IActionResult> OnPostExportToExcelAsync([FromBody] ExcelExportData request)
{
byte[] fileContents = DoWorkToCreateExcelFile();
return File(
fileContents,
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
"MyFile.xslx");
}
ThanksPaul