Friday 15 November 2013

Restrict Ajax Calender future and past date using javascript

<script type="text/ecmascript">

    function checkDates(sender, args) {
       // alert(sender._selectedDate + "    enter    " + new Date());
        if (sender._selectedDate > new Date()) {
            alert('Date must be less than Today');
            sender._selectedDate = new Date();
            // set the date back to the current date
            sender._textbox.set_Value(sender._selectedDate.format(sender._format))
        }
    }
</script >

//HTML
 <asp:TextBox runat="server"  ID="dtForm"  Enabled="False" ></asp:TextBox>

<asp:CalendarExtender ID="CalendarExtender1" runat="server" PopupButtonID="cal_Surveyor"
TargetControlID="dtForm" OnClientDateSelectionChanged="checkDates"  Enabled="True" Format="dd/MM/yyyy"></asp:CalendarExtender>

No comments:

Post a Comment

Excel Sort values in ascending order using function TEXTJOIN

 Excel ::  Text ::  1,3,5,2,9,5,11 Result :: 1,2,3,5,5,9,11 Formula ::     TEXTJOIN ( ",",1,SORT(MID(SUBSTITUTE( A1 ,","...