New to Telerik UI for ASP.NET AJAX? Start a free 30-day trial
AppointmentCreated
The AppointmentCreated event occurs immediately after an appointment template is instantiated.
AppointmentCreated has two parameters:
-
sender is the scheduler control.
-
e is an object of type AppointmentCreatedEventArgs.It has two properties:
-
Appointment is the appointment which representation is about to be shown.
-
Container is the representation template of the appointment.
You can use this event to modify the appointment template before data binding.
Example
In this example, the appearance of the appointment is changed based on a custom attribute.A label is updated to show the value of the attribute, and the appointment style sheet is changedto customize the appearance of the appointment based on the attribute.
C#
protected void RadScheduler1_AppointmentCreated(object sender, Telerik.Web.UI.AppointmentCreatedEventArgs e)
{
Label moderatorLabel = (Label)e.Container.FindControl("Moderator");
moderatorLabel.Text = e.Appointment.Attributes["Moderator"];
switch (e.Appointment.Attributes["Moderator"])
{
case "McGregor":
e.Appointment.CssClass = "McGregorStyle";
break;
case "John Doe":
e.Appointment.CssClass = "JDStyle";
break;
case "Smith":
e.Appointment.CssClass = "SmithStyle";
break;
case "Anderson":
e.Appointment.CssClass = "AndersonStyle";
break;
default:
break;
}
}