private void Dashboard_CustomDataCallback(object sender, DevExpress.Web.CustomDataCallbackEventArgs e) { if (e.Parameter.StartsWith(dashboardStatePrefix)) { var settings = GetDasbhoardSettings(true); string state = e.Parameter.Substring(dashboardStatePrefix.Length); var args = new SaveDashboardStateEventArgs(state); CustomSaveDashboardState?.Invoke(this, args); if (!args.Handled) { settings.State = state; View.SaveModel(); } } }
protected void ASPxDashboard1_CustomDataCallback(object sender, DevExpress.Web.CustomDataCallbackEventArgs e) { Dictionary <string, string> parameters = new JavaScriptSerializer().Deserialize <Dictionary <string, string> >(e.Parameter); if (!parameters.ContainsKey("ExtensionName")) { return; } CustomDashboardFileStorage newDashboardStorage = new CustomDashboardFileStorage(@"~/App_Data/Dashboards"); if (parameters["ExtensionName"] == "dxdde-delete-dashboard" && parameters.ContainsKey("DashboardID")) { newDashboardStorage.DeleteDashboard(parameters["DashboardID"]); } }
protected void ASPxDashboard1_CustomDataCallback(object sender, DevExpress.Web.CustomDataCallbackEventArgs e) { using (MemoryStream stream = new MemoryStream()) { string selectedDashboardID = e.Parameter.Split('|')[0]; string dashboardStateJson = e.Parameter.Split('|')[1]; DashboardState dashboardState = new DashboardState(); dashboardState.LoadFromJson(dashboardStateJson); DashboardPdfExportOptions pdfOptions = new DashboardPdfExportOptions(); pdfOptions.ExportFilters = true; pdfOptions.DashboardStatePosition = DashboardStateExportPosition.Below; string dateTimeNow = DateTime.Now.ToString("yyyyMMddHHmmss"); string filePath = "~/App_Data/Export/" + selectedDashboardID + "_" + dateTimeNow + ".pdf"; ASPxDashboardExporter exporter = new ASPxDashboardExporter(ASPxDashboard1); exporter.ExportToPdf(selectedDashboardID, stream, new System.Drawing.Size(1920, 1080), dashboardState, pdfOptions); SaveFile(stream, filePath); e.Result = filePath; } }