This example illustrates how to download a file on a custom ribbon item click.
The item is added in code behind to the existing ribbon tabs. The tabs are generated by the ASPxSpreadsheet.CreateDefaultRibbonTabs method:
Spreadsheet.CreateDefaultRibbonTabs(true);
RibbonButtonItem item = new RibbonButtonItem("Download", "Download");
Spreadsheet.RibbonTabs[1].Groups[0].Items.Insert(0, item);
Since it is not possible to download a document on a callback request, a ribbon item should send a postback. For this, use the __doPostBack function in the client-side ASPxClientSpreadsheet.CustomCommandExecuted event handler:
function onCustomCommandExecuted(s,e) {
if (e.commandName == "Download")
__doPostBack("DownloadExcel");
}
ASPxSpreadsheet in this example loads data from a database, so the default file dialogs are disabled.
Note that a cell doesn't get the value an end-user entered until the user clicks Enter or tabs out of this cell. As a result the issue with saving an entered value may occur if the value was not submitted. To force submission of the last entered value, call the ASPxClientSpreadsheet.ApplyCellEdit method.
(you will be redirected to DevExpress.com to submit your response)