This is a program code which will provide info about -Ajax calender extender with java script to the developer.It will mostly used to select dates like birthdate.If user wants to select any dates prior to current date then s/he will not able to select any future date.
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>devloper4u</title>
<script type="text/javascript">
function CurrentDateShowing(e) {
if (!e.get_selectedDate() || !e.get_element().value)
e._selectedDate = (new Date()).getDateOnly();
}
</script>
<script type="text/javascript">
function CheckDateEalier(sender, args) {
if (sender._selectedDate > new Date()) {
alert("Day earlier than today cannot be selected.");
sender._selectedDate = new Date();
sender._textbox.set_Value(sender._selectedDate.format(sender._format))
}
}
</script>
</head>
<body>
<form id="form1" runat="server">
<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
<div>
<asp:TextBox ID="txtDOB" runat="server"></asp:TextBox>
<asp:ImageButton ID="Imgbutton1" runat="server" ImageUrl="~/images/Calendar_scheduleHS.png" />
<cc1:CalendarExtender ID="CalendarExtender2" runat="server" Format="dd/MM/yyyy" PopupButtonID="Imgbutton1"
TargetControlID="txtDOB" OnClientDateSelectionChanged="CheckDateEalier">
</cc1:CalendarExtender>
</div>
</form>
</body>
</html>
23:35
|
Category:
|
0
comments