RadControls for ASP.NET AJAX RadDatePicker, RadTimePicker,
RadDateTimePicker and RadMonthYearPicker expose the ChildrenCreated server event, which occurs after the child controls are created.
Caution |
|---|
ChildrenCreated can be wired only during the Page_PreInit event, since it is fired before the regular handlers are attached. |
TheChildrenCreated event handler receives two arguments:
The control whose children have just been created. This argument is of type object, but can be cast to the appropriate type.
A DefaultViewChangedEventArgs object. This object has the following two properties:
You can use this event to set date input, calendar and time view properties, or add additional controls. The following example uses the ChildrenCreated event handler to add a control that clears the selection:
CopyC#
protected void RadDatepicker1_ChildrenCreated(object sender, System.EventArgs e)
{
RadDatePicker picker = (RadDatePicker)sender;
HyperLink clearLink = new HyperLink();
clearLink.NavigateUrl = string.Format("javascript:$find('{0}').Clear()", picker.ClientID);
clearLink.Text = "Clear";
picker.Controls.Add(clearLink);
}
CopyVB.NET
Protected Sub RadDatePicker1_ChildrenCreated(ByVal sender As Object, ByVal e As System.EventArgs) Handles RadDatePicker1.ChildrenCreated
Dim picker As RadDatePicker = DirectCast(sender, RadDatePicker)
Dim clearLink As New HyperLink()
clearLink.NavigateUrl = _
String.Format(, picker.ClientID)
clearLink.Text = "Clear"
picker.Controls.Add(clearLink)
End Sub
See Also