Wednesday, February 1, 2012

Date Validation for Ajaxcalendar extendar control in asp.net



 <script language="javascript" type="text/javascript">
        function CheckEndDate(sender, args) {
            date1 = new Date()
            date1.setHours(0, 0, 0, 0);
            if (sender._selectedDate < date1) {
                alert("Expiry Date should not be less than current date! ");
                sender._selectedDate = new Date();
                // set the date back to the today
                sender._textbox.set_Value(sender._selectedDate.format(sender._format))
            }
            else {
                
            }

        }
    </script>

 <asp:TextBox ID="txtStartDate" runat="server"> </asp:TextBox>
                                            <asp:ImageButton ID="CalendarImage1" runat="server" Height="18px" ImageAlign="AbsMiddle" ImageUrl="~/App_Themes/Default/images/Calendar_view_month.png" />
                                            <cc1:CalendarExtender ID="CalendarExtender1" runat="server" Enabled="True" FirstDayOfWeek="Sunday" Format="dd/MM/yyyy" PopupButtonID="CalendarImage1" TargetControlID="txtStartDate">
 </cc1:CalendarExtender>


No comments:

Post a Comment

Comments

Search

Custom Search
Protected by Copyscape Plagiarism Software