This example demonstrates how you can dynamically change a report displayed by the DocumentViewer extension.
A callback is used to switch reports. So, the DocumentViewer extension is placed into the CallbackPanel extension. After the ComboBox selection is changed, a callback is sent to the CallbackPanel extension to update the DocumentViewer.
Question Comments
Added By: Réal Chartarnd at: 4/8/2016 6:47:41 AM There's a bug in your example, if you add a dummy ribbon toolbar to DocumentViewerevery time we export to PDF is the first report that is exported, regardlessthe report that is displayed. if you have a solution, I am really interested
@Html.DevExpress().Ribbon(settingsRb =>{ settingsRb.Name = "RibbonTest"; settingsRb.Tabs.AddRange(DocumentViewerExtension.DefaultRibbonTabs);}).GetHtml();
@Html.DevExpress().DocumentViewer(settings => { settings.Name = "DocumentViewer"; settings.CallbackRouteValues = new { Controller = "Home", Action = "DocumentViewerPartial", ReportName = Model.ReportName }; settings.ExportRouteValues = new { Controller = "Home", Action = "DocumentViewerExport", ReportName = Model.ReportName }; settings.Report = Model.CreateReport();
settings.ToolbarMode = DocumentViewerToolbarMode.ExternalRibbon; settings.AssociatedRibbonName = "RibbonTest";}).GetHtml()