Log In
Home
Support
Demos
Documentation
Blogs
Training
Webinars
[Expand]General Information
[Expand]WinForms Controls
[Collapse]ASP.NET Controls and MVC Extensions
 [Expand]Prerequisites
 [Expand]What's Installed
 [Expand]Common Concepts
 [Collapse]ASP.NET WebForms Controls
  [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
    [Collapse]Customization
     [Collapse]Appearance
       How to: Set the Scheduler's Size
       How to: Customize Resource Headers
       How to: Fill Resource Headers with Specific Colors
       How to: Customize Time Cells via Templates
     [Expand]Behavior
     [Expand]Custom Forms and Custom Fields
    [Expand]Printing and Reporting
    [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]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]Cross-Platform Core Libraries
[Expand]Tools and Utilities
 End-User Documentation

How to: Customize Resource Headers

The following topic demonstrates how the appearance of Resource Headers can be customized by inserting a picture and a checkbox. This technique of Web Server Control Templates is useful for changing the appearance of other visual elements of the scheduler as well.

The resultant page is shown below:

The ASPxScheduler control provides a set of ASPxScheduler.Templates used for customizing the appearance of its visual elements. The template enables you to create controls and set their properties and layout, evaluate and display data binding expressions. The following templates are available: HorizontalResourceHeaderTemplate, DateHeaderTemplate, DayOfWeekHeaderTemplate, VerticalResourceHeaderTemplate, AppointmentTemplate.

You can define a template within the body of a page using declarative syntax, as in the demo application, Templates / Resource Header Template section. In the current topic we demonstrate how the template can be created programmatically in the code-behind page.

The following example illustrates the templates mechanism to customize the Resource Headers by inserting a picture of the specified resource and a checkbox.

The templates in this example are created and assigned programmatically and dynamically, in the code-behind file. To accomplish this, we instantiate a class which implements the System.Web.UI.ITemplate interface, provided by Microsoft® .NET Framework. The ITemplate interface has only one method, which is called InstantiateIn. This method defines how the templated control is populated with HTML content and controls. We'll add an ASPxImage control to display an image, and a ASPxCheckBox control.

To obtain an image of the current resource, we have to run a query on a data table to retrieve an object, representing an image for the specified resource ID. Then, this object is transformed from a byte sequence into a JPG file and resized as needed to fit into a resource header. This file is saved on a server and its mapped URL is specified to set an ASPxImage.ImageUrl property of an image control. Note that the image thumbnails remain on the server and you are responsible for deleting them when they are no longer needed.

The database in this example is the MS Access CarsDB.mdb, included into the DevExpress Suite installation package.

Expanded See Also

How would you rate this topic?​​​​​​​