Is it possible to trigger a file download from a custom PageCommand
?
I am wanting to extend a listing page (e.g. UserList), and add a new HeaderAction
button which downloads a file.
public class UserListExtender : PageExtender<UserList>
{
public override async Task ConfigurePage()
{
await base.ConfigurePage();
Page.PageConfiguration.HeaderActions.AddCommand(
label: "Download",
command: nameof(MyExtenderCommand),
icon: Icons.Ribbon,
destructive: false
);
}
[PageCommand]
public async Task<ICommandResponse> MyExtenderCommand()
{
// Code here to generate and download a file
return Response().AddSuccessMessage("File ready to download.");
}
}
Since ICommandResponse
only has a collection of messages, I assume this is not really possible.
Environment
- Xperience by Kentico version: [29.6.0]
- .NET version: 8
- Execution environment: Local
- Link to relevant Xperience by Kentico documentation