Log In
Home
Support
Demos
Documentation
Blogs
Training
Webinars
[Expand]Welcome to DevExpress .NET Documentation
[Expand]WinForms Controls
[Collapse]ASP.NET Controls and MVC Extensions
 [Expand]Prerequisites
 [Expand]What's Installed
 [Expand]Common Concepts
 [Collapse]ASP.NET WebForms Controls
   Getting Started
  [Expand]Reporting
  [Expand]Chart Control
  [Expand]Grid View
  [Expand]Card View
  [Expand]Vertical Grid
  [Expand]Spreadsheet
  [Expand]Rich Text Editor
  [Expand]Image and Data Browsing
  [Expand]Docking and Popups
  [Expand]Site Navigation and Layout
  [Expand]File Management
  [Expand]Multi-Use Site Controls
  [Collapse]Scheduler
   [Expand]Product Information
    Getting Started
   [Expand]Fundamentals
   [Expand]Concepts
   [Expand]Visual Elements
   [Expand]Design-Time Features
   [Collapse]Examples
    [Expand]Data Binding
    [Expand]Selection
    [Expand]Customization
    [Collapse]Printing and Reporting
      How to: Print the ASPxScheduler Using a Report Preview (Step-by-Step Guide)
    [Expand]Miscellaneous
   [Expand]End-User Capabilities
   [Expand]Member Tables
  [Expand]HTML Editor
  [Expand]Pivot Grid
  [Expand]Tree List
  [Expand]Gauges
  [Expand]Data Editors
  [Expand]Spell Checker
  [Expand]Query Builder
 [Expand]ASP.NET MVC Extensions
 [Expand]Localization
 [Expand]Redistribution and Deployment
  Get More Help
 [Expand]API Reference
[Expand]ASP.NET Bootstrap Controls
[Expand]ASP.NET Core Bootstrap Controls
[Expand]WPF Controls
[Expand]Xamarin Controls
[Expand]Windows 10 App Controls
[Expand]Document Server
[Expand]Reporting
[Expand]Report Server
[Expand]Dashboard
[Expand]eXpressApp Framework
[Expand]CodeRush
[Expand]CodeRush Classic
[Expand]Cross-Platform Core Libraries
[Expand]Tools and Utilities
 End-User Documentation

How to: Print the ASPxScheduler Using a Report Preview (Step-by-Step Guide)

This document describes how to create a simple report and preview it before sending it to a printer. To create a printout for ASPxScheduler, create an XtraSchedulerReport class descendant instance that uses ASPxScheduler data and print it using the ReportViewer Web control.

This guide consists of the following sections:

Expanded Prerequisites. Create a New Web Application

This step is required to create a sample application that contains a data-bound ASPxScheduler control.

Create a new Outlook Inspired Web Application for ASP.NET WebForms using the $Project Wizard and name it SchedulerReportPreviewTest.

Expanded Steps 1-3. Add a Scheduler Report to the Web Application

  1. Create a new folder named Reports in your application.
  2. Right-click the newly created folder in the Solution Explorer window and select Add DevExpress Item | New Item.... In the DevExpress Template Gallery dialog, select Web Scheduling section and click the Scheduler Report thumbnail to create the XtraSchedulerReport1.cs file and add it to the project:

  3. A new blank Scheduler report is added to your application. Visual Studio shows the designer for the newly created report (it is named XtraSchedulerReport1 by default). The report descends from the XtraSchedulerReport class, which is the base class for all reports.

Expanded Steps 4-9. Load a Report from a Template

Note

To create a report from scratch, skip to Step 10.

  1. To create a report, use one of the templates from the gallery of ready-to-use report layout templates. Connect to this gallery at design time within Visual Studio by clicking the report's smart tag, and in the invoked Report Tasks list, select the Load Report Template... link.

  2. In the invoked Report Templates dialog, select the template and click Load. You can also search for a specific template using the search box.

  3. The selected report is loaded to the Visual Studio designer.

  4. Set the ReportViewBase.VisibleResourceCount property to 3 to display information about several resources on a single report page.

  5. Set the DayViewTimeCells.ShowWorkTimeOnly property to true to display only a “work time” interval in the report.

  6. Set the DayViewTimeCells.ExtraCells.Visible property to false.

Expanded Step 10. Create a Report from Scratch

Note

You can also create a Scheduler Report from scratch (instead of loading it from the predefined template gallery) by following steps 7-15 in the How to: Print a Scheduler Using a Report Preview (Step-by-Step Guide) topic. However, we recommend using the predefined templates which contain common Scheduler Report layouts.

Expanded Steps 11-13. Create a Preview Form

  1. Add a new web user control to the Reports folder by right-clicking it in the Solution Explorer and selecting Add New Item | Web Forms User Control in the invoked menu. Name the control ReportPreview.ascx.
  2. Drag the ASPxWebDocumentViewer control from the Toolbox's DX.17.2: Reporting tab and drop it onto the ReportPreview user control's design page. Set its ASPxWebDocumentViewer.ClientInstanceName to clientReportViewer.
  3. In the code-behind ReportPreview.ascx.cs file, declare the following public method (this method is also used to generate the report content):

    Show me

    The complete sample project is available in the DevExpress Code Examples database at http://www.devexpress.com/example=E1625.

Expanded Steps 14-18. Add the Popup Control to the Calendar Page

  1. Open the Calendar.aspx page, drag the ASPxPopupControl from the Toolbox's DX.17.2: Navigation & Layout tab and drop it on the page. Set its ASPxPopupControlBase.ClientInstanceName to "ASPxPopupControl1". The ASPxPopup control is used to display the ReportPreview user control implemented in the previous steps. Specify the popup window size and location by setting its ASPxPopupControl.PopupHorizontalAlign and ASPxPopupControl.PopupVerticalAlign properties to PopupHorizontalAlign.WindowCenter and PopupVerticalAlign.WindowCenter, respectively. Set the Height to 680px, the Width to 600px, and the ASPxPopupControl.Modal property to true.
  2. In the Calendar.aspx page, create an @Register directive:

  3. Drag the ASPxSchedulerControlPrintAdapter control from the Toolbox's DX.17.2: Scheduling tab and drop it on the page. Set its ASPxSchedulerControlPrintAdapter.SchedulerControl property to the ASPxScheduler's ID on the same page.
  4. Place a ReportViewer instance inside the ASPxPopupControl. The code bellow illustrates the ASPxPopupControl's resulting markup created in steps 14-16:

  5. Handle the ASPxPopupControlBase.WindowCallback event as follows:

Expanded Steps 19-20. Add the Code to Display the Report Preview

  1. Place ASPxButton above the SchedulerControl, set its Text property to "Show Report" and the AutoPostBack property to "false".
  2. Handle the button's client-side Click event as follows:

Expanded Display the Report

Run the project and click the "Show Result" button. The report is displayed in the Preview window, as shown in the following image:

Is this topic helpful?​​​​​​​