KaxDateTimePickerItemCreated Event |
Namespace: Kettic.AspNet.Controls
The ItemCreated event is raised when an item in the KaxTimeView control is created, both during round-trips and at the time data is bound to the control.
The ItemCreated event is commonly used to control the content and appearance of a row in the KaxTimeView control.
The following code example demonstrates how to specify and code a handler for the ItemCreated event to set the CSS styles on the KaxTimeView.
[AspNet]
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>
<%@ Register Assembly="KaxCalendar.Net2" Namespace="Kettic.AspNetControls" TagPrefix="kaxCln" %>
<!DOCTYPE html PUBLIC"-//W3C//DTD XHTML 1.0 Transitional//EN""http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Untitled Page</title>
<style type="text/css">
.TimeCss
{
background-color: Red;
}
.AlternatingTimeCss
{
background-color: Yellow;
}
</style>
</head>
<body>
<form id="form1"
runat="server">
<div>
<kaxCln:KaxTimePicker
OnItemCreated=
"KaxTimePicker1_ItemCreated"
ID="KaxTimePicker1"
runat="server">
</kaxCln:KaxTimePicker>
</div>
</form>
</body>
</html>
protected void KaxTimePicker1_ItemCreated(object sender, Kettic.AspNetControls.Base.Calendar.Events.TimePickerEventArgs e) { if (e.Item.ItemType == ListItemType.Item) { e.Item.CssClass = "TimeCss"; } if (e.Item.ItemType == ListItemType.AlternatingItem) { e.Item.CssClass = "AlternatingTimeCss"; } }