New to Telerik UI for ASP.NET AJAX? Start a free 30-day trial
ItemCreated
RadDateTimePicker provides the ItemCreated server event, which is invoked after an item in the embedded time view control is created. This event occurs both when the control is created after a postback, and at the time data is bound to the control.
The ItemCreated event handler receives two arguments:
-
The control whose value has just changed. This argument is of type object, but can be cast to the appropriate type.
-
A TimePickerEventArgs object. This object has an Item property, which lets you access the DataListItem for the newly-created item.
You can use this event to customize the content or appearance of items in the time picker:
C#
protected void RadDateTimePicker1_ItemCreated(object sender, TimePickerEventArgs e)
{
if (e.Item.ItemType == ListItemType.Item)
{
if (e.Item.ItemIndex < 3)
e.Item.CssClass = "FirstTimeRowCss";
}
if (e.Item.ItemType == ListItemType.AlternatingItem)
{
if (e.Item.ItemIndex < 3)
e.Item.CssClass = "FirstAlternatingTimeRowCss";
}
}