The requested page is not available for the requested platform. You are viewing the content for Default platform.

ASPxScheduler.HtmlTimeCellPrepared Event

Occurs when the HTML code representing the time cell is prepared for display.

Namespace: DevExpress.Web.ASPxScheduler

Assembly: DevExpress.Web.ASPxScheduler.v19.2.dll

Declaration

public event ASPxSchedulerTimeCellPreparedEventHandler HtmlTimeCellPrepared
Public Event HtmlTimeCellPrepared As ASPxSchedulerTimeCellPreparedEventHandler

Event Data

The HtmlTimeCellPrepared event handler receives an argument of the ASPxSchedulerTimeCellPreparedEventArgs type. The following properties provide information specific to this event.

Property Description
Cell Provides access to the HTML table cell which represents the current time cell of the Scheduler.
Interval Gets the time interval which characterizes the current time cell.
Resource Gets the resource of a cell related to the ASPxScheduler.HtmlTimeCellPrepared event.
View Provides access to the Scheduler View.

Remarks

The HtmlTimeCellPrepared event occurs before a time cell is rendered. Handling this event enables you to specify the style and color of a particular time cell, and even insert a Literal control to display text.

Note

Subscribing to the HtmlTimeCellPrepared event automatically disables client-side rendering of view elements.

The following code snippet uses the HtmlTimeCellPrepared event to highlight dinner time.

using DevExpress.Web.ASPxScheduler;
using DevExpress.Web.Internal;
using DevExpress.XtraScheduler;
    protected void OnHtmlTimeCellPrepared(object sender, ASPxSchedulerTimeCellPreparedEventArgs e) {
        TimeInterval cellInterval = e.Interval;
        if (e.View.Type == DevExpress.XtraScheduler.SchedulerViewType.Day) {
            TimeSpan dinnerStart = new TimeSpan(15, 0, 0);
            TimeSpan dinnerEnd = new TimeSpan(17, 0, 0);
            TimeSpan cellStart = cellInterval.Start.TimeOfDay;
            TimeSpan cellEnd = cellInterval.End.TimeOfDay;
            if (cellStart >= dinnerStart && cellStart <= dinnerEnd && cellEnd <= dinnerEnd) {
                e.Cell.BackColor = Color.Red;
                string valueString = HtmlConvertor.ToHtml(Color.Yellow);
                e.Cell.Style.Add("border-bottom-color", valueString);
                e.Cell.Style.Add("text-align", "center");
                e.Cell.Controls.Add(new LiteralControl("dinner"));
            }
        }
        if (e.View.Type == SchedulerViewType.Week) {
            DateTime specialDate = new DateTime(2008, 7, 24);
            if (cellInterval.Start == specialDate) 
                e.Cell.BackColor = Color.Green;
        }
    }
See Also