$99 VS $1000+. UI Control for ASP.NET AJAX(contains chart and gridview).
Picker Server Side Event in ASP.NET
Home > How to > Picker Server Event

Within Kettic asp.net Calendar server side events can be classified into different categories according to different picker. DatePicker, TimePicker, DateTimePicker and MonthYearPicker provides ChildrenCreated and SelectedDateChanged server events.

ChildrenCreated for ASP.NET AJAX

This server event occurs after the child and sub-controls are created and can be wired only during the Page_PreInit event, since it is fired before the regular handlers are attached.

SelectedDateChanged for ASP.NET AJAX

This server event is provided by these embedded controls: DatePicker, TimePicker, DateTimePicker and MonthYearPicker, which happens when the user changes the value of the control, either when input area loses focus after the user has typed a new value, or when the user selects a new value in the popup calendar or time view control. And this server event can only occur when users set PostBack property is True.
Online ASPX example codes for setting SelectedDateChanged event with Kettic ASP.NET AJAX calendar.

<kettic:PerDateTimePickerAutoPostBackControl="Both" ID="PerTimePicker1" runat="server"
OnSelectedDateChanged="PerTimePicker1_SelectedDateChanged">
</kettic:PerDateTimePicker>
Check out following C# codes for SelectedDateChanged event with Kettic ASP.NET AJAX calendar.

protectedvoid PerTimePicker1_SelectedDateChanged(object sender, SelectedDateChangedEventArgs e)
{
txtLog.Text += "SelectedDateChanged event fired:\r\n";
}
TimePicker and DateTimePicker offer two certain server events: ItemCreated and ItemDataBound.

ItemCreated for ASP.NET AJAX

ItemCreated server event will occur when users add an item in the embedded time view control is created. This event occurs also when users create control after a postback, and at the time data is bound to the control.
Please see following demo ASPX codes for ItemCreated in ASP.NET application.

<kettic:PerDateTimePickerAutoPostBackControl="
Both"
ID="PerTimePicker1"runat="server"OnItemCreated="
PerTimePicker1_ItemCreated"
>
</kettic:PerDateTimePicker>
Please refer to following C# code for ItemCreated in ASP.NET application.

protectedvoid PerTimePicker1_ItemCreated(object sender, TimePickerEventArgs e)
{
txtLog.Text += String.Format("ItemCreated event fired: ItemIndex is - [{0}]; ItemType is - {1};\r\n", e.Item.ItemIndex, e.Item.ItemType);
}

ItemDataBound for ASP.NET AJAX

When users add an item in the embedded time view control is bound to its data, the ItemDataBound server event occurs. This event provides the last opportunity to access the data item before it is displayed on the client. As long as this event is raised, the data item is no longer available.
ASPX example codes for ItemDataBound within ASP.NET project by using Kettic ASP.NET AJAX calendar.

<kettic:PerDateTimePickerAutoPostBackControl="Both"
ID="PerTimePicker1"
runat="server"OnItemDataBound="
PerTimePicker1_ItemDataBound"
>
</kettic:PerDateTimePicker>
C# code for ItemDataBound within ASP.NET project by using Kettic ASP.NET AJAX calendar.

protectedvoid PerTimePicker1_ItemDataBound(object sender, TimePickerEventArgs e)
{
txtLog.Text += String.Format("ItemDataBound event fired: ItemIndex is - [{0}]; ItemType is - {1};\r\n", e.Item.ItemIndex, e.Item.ItemType);
}
ViewCellCreated is the only server event occurring in the embedded MonthYearPicker control.

ViewCellCreated for ASP.NET AJAX

MonthYearPicker provides the ViewCellCreated server event, which will happen when MonthCell, YearCell, NavigationCell and ButtonCell in MonthYearTableView are built up.
Please copy and paste following ASPX sample codes directly for ViewCellCreated server event.

<kettic:PerMonthYearPickerID="PerMonthYearPicker1"
runat="server" AutoPostBack="true"Skin="Office2010Silver" OnViewCellCreated="PerMonthYearPicker1_ViewCellCreated">
</kettic:PerMonthYearPicker>
Use following C# code for setting ViewCellCreated server event within ASP.NET application.

protectedvoid PerMonthYearPicker1_ViewCellCreated(object sender, MonthYearViewCellCreatedEventArgs e)
{
if (e.Cell.CellType == MonthYearViewCellType.MonthCell)
{
e.Cell.Style["font-color"] = "#330000";
e.Cell.Style["background"] = "#ffffcc";
HyperLinkhplMonth = (e.Cell.Controls[0] asHyperLink);
hplMonth.BorderColor = Color.FromArgb(255, 190, 60);
}


}
ASP.NET AJAX UI Controls