New to Telerik UI for ASP.NET AJAXStart a free 30-day trial

HeaderCellRender

The ASP NET AJAX Calendar control provides the HeaderCellRender server event, which is raised after all the row and column headers and the view selector have been generated and just before one of these header cells is rendered to the client. It is the last place where changes to the already constructed header cells can be made.

The HeaderCellRender event does not fire if the calendar does not display its row and column headers or view selectors. That is, if the ShowRowHeaders, ShowColumnHeaders and EnableViewSelector properties are all False, the event does not fire.

The HeaderCellRender event handler has two arguments:

  1. The RadCalendar control whose header cell is about to be rendered. This argument is of type object, but can be cast to the RadCalendar type.

  2. A HeaderCellRenderEventArgs object. This object has the following two properties:

    • Cell is the control for the cell that is about to be rendered. The event handler can make changes to this control to change the way the cell is rendered.

    • HeaderType is an enumerated value that indicates whether the cell represents a row header, column header, or view selector.

Use the HeaderCellRender event handler to make changes to the header cell before it is rendered:

C#
protected void RadCalendar1_HeaderCellRender(object sender, HeaderCellRenderEventArgs e)
{
    switch (e.HeaderType)
    {
        case Telerik.Web.UI.Calendar.HeaderType.Column:
            e.Cell.BackColor = System.Drawing.Color.Red;
            break;
        case Telerik.Web.UI.Calendar.HeaderType.Row:
            e.Cell.BackColor = System.Drawing.Color.Green;
            break;
        case Telerik.Web.UI.Calendar.HeaderType.View:
            e.Cell.BackColor = System.Drawing.Color.White;
            break;
    }
}

See Also

In this article
See Also
Not finding the help you need?
Contact Support