Glossary Item Box
InputDateTime has some client-side API functions to easily manipulate with control and its value without postback.
The control has some client-side events:
| Client-side event | Description |
| onBeforeChange | Occurs when the selected date is about to be changed. |
| onChange | Occurs when the selected date is changed. |
| onIsNotValid | Occurs when the user tries to select an invalid date. |
Client-side API functions list:
| Function name | Description |
| al_InputDateTime_SetEnable(clientID, isEnable) | Enables or disables the InputDateTime control with given identifier clientID, new state sets with isEnable value |
| al_InputDateTime_IsEnabled(clientID) | Returns is the control enabled or not |
| al_InputDateTime_SetVisible(clientID, isVisible) | Shows or hides the control with identifier clientID, new state depends on isVisible value |
| al_InputDateTime_IsVisible(clientID) | Returns is the control visible or not |
| al_InputDateTime_SetValue(clientID, year, month, day, hour, minute, second) | Sets the control's date - set year to year, month to month, day to day etc |
| al_InputDateTime_GetValue(clientID) | Gets the control's date - returns the JavaScript Date object with selected date or null if nothing selected |
| al_InputDateTime_SetMinDate(clientID, year, month, day) | Setting new minimal date for the InputDateTime control. The date sets only on client side and doesn't change any server settings. |
| al_InputDateTime_SetMaxDate(clientID, year, month, day) | Setting new maximal date for the InputDateTime control. The date sets only on client side and doesn't change any server settings. |
Example:
<cc1:InputDateTime ID="InputDateTime1" runat="server"></cc1:InputDateTime>
<input id="btn1" onclick="al_InputDateTime_SetEnable('InputDateTime1', false);" type="button" value="Disable InputDateTime" />
<input id="btn2" onclick="al_InputDateTime_SetEnable('InputDateTime1', true);" type="button" value="Enable InputDateTime" />
<input id="btn2" onclick="al_InputDateTime_SetVisible('InputDateTime1', true);" type="button" value="Show InputDateTime" />
<input id="btn2" onclick="al_InputDateTime_SetVisible('InputDateTime1', false);" type="button" value="Hide InputDateTime" />
<input id="btn2" onclick="al_InputDateTime_SetValue('InputDateTime1', 2006, 6, 15, 12, 15, 30);" type="button" value="Set InputDateTime value to '15 June 2006, 12:15:30'" />
<input id="btn2" onclick="alert(al_InputDateTime_GetValue('InputDateTime1'));" type="button" value="Get InputDateTime value" />
| See Also |
Controls: InputDateTime