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

ViewCellCreated

RadMonthYearPicker provides the ViewCellCreated server event, which fires when MonthCell, YearCell, NavigationCell and ButtonCell in MonthYearTableView are created.

The ViewCellCreated event handler receives two arguments:

  1. The control whose value has just changed. This argument is of type object,but can be cast to the appropriate type.

  2. A MonthYearViewCellCreatedEventArgsobject.This object has a Cellproperty, which lets you access the cell in MonthYearTableView.

You can use this event to customize the content or appearance of cells in the month year picker based on their type:

C#
protected void RadMonthYearPicker1_ViewCellCreated(object sender, UI.MonthYearViewCellCreatedEventArgs e)
{
    RadMonthYearPicker1.MonthCellsStyle.BorderColor = Color.FromArgb(255, 190, 60);

    if (e.Cell.CellType == MonthYearViewCellType.MonthCell)
    {
        e.Cell.Style["font-color"] = "#330000";
        e.Cell.Style["background"] = "#ffffcc";
        HyperLink hplMonth = (e.Cell.Controls[0] as HyperLink);
        hplMonth.BorderColor = Color.FromArgb(255, 190, 60);
    }
    if (e.Cell.CellType == MonthYearViewCellType.YearCell)
    {
        e.Cell.Style["font-color"] = "#330000";
        e.Cell.Style["background"] = "#ffffcc";
        HyperLink hplYear = (e.Cell.Controls[0] as HyperLink);
        hplYear.BorderColor = Color.FromArgb(255, 190, 60);
    }
    if (e.Cell.CellType == MonthYearViewCellType.NavigationCell)
    {
        e.Cell.Style["font-color"] = "#330000";
        e.Cell.Style["background"] = "#fff3ad";
        HyperLink hplNavigate = (e.Cell.Controls[0] as HyperLink);
        hplNavigate.Style["color"] = "#ccb67e";
    }
    if (e.Cell.CellType == MonthYearViewCellType.ButtonCell)
    {
        e.Cell.Style["font-color"] = "#330000";
        e.Cell.Style["background"] = "#ffcc66";
        Button btnToday = (e.Cell.Controls[0] as Button);
        btnToday.Style["text-decoration"] = "underline";
        Button btnOk = (e.Cell.Controls[1] as Button);
        btnOk.Style["text-decoration"] = "underline";
        Button btnCancel = (e.Cell.Controls[2] as Button);
        btnCancel.Style["text-decoration"] = "underline";
    }
}

See Also

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