title: Format date in Ajax calendar
body: <p>I had Ajax Calendar and I want to prevent user to choose date (Today or future date) I had java script code but It when I prevent me to select date earlier as (10-10-1990).Plaes any one help me.</p>
  
  <p><strong>Javascript</strong></p>
  
  <pre><code>&lt;script type="text/javascript"&gt;
         function checkDate(sender,args)
  {
   if (sender._selectedDate &lt; new Date()) 
              {
                  alert("You cannot select a day earlier than today!");
                  sender._selectedDate = new Date(); 
                  // set the date back to the current date
  sender._textbox.set_Value(sender._selectedDate.format(sender._format))
              }
  }
      &lt;/script&gt;
  </code></pre>
  
  <p><strong>ASPX</strong></p>
  
  <pre><code>&lt;table&gt;
  &lt;tr&gt;
      &lt;td class="bod_d_reg_txt_p lm7"&gt; Birth year : &lt;/td&gt;
      &lt;td colspan="3"&gt;&lt;asp:TextBox ID="TXTBirthdate" runat="server" Width="150px" ReadOnly="True"&gt;&lt;/asp:TextBox&gt;
          &lt;label&gt;
              &lt;cc1:CalendarExtender ID="CalendarExtender1" runat="server" TargetControlID="TXTBirthdate"
                                                                              OnClientDateSelectionChanged="checkDate" PopupButtonID="Image1"&gt; &lt;/cc1:CalendarExtender&gt;
              &lt;asp:Image ID="Image1" runat="server" ImageUrl="~/images/Calendar_scheduleHS.png" /&gt;
          &lt;/label&gt;
          &lt;asp:CompareValidator ID="cmp" ControlToValidate="TXTBirthdate" runat="server" ErrorMessage="*"
                                                                          Operator="LessThanEqual" Type="Date" Display="Dynamic"&gt;*&lt;/asp:CompareValidator&gt;
          &lt;br /&gt;
          &lt;span style="font-family: 'MS SystemEx'; color: #C0C0C0"&gt;(Click the image button to
          show the calendar to choose your date) &lt;/span&gt;&lt;/td&gt;
  &lt;/tr&gt;
  &lt;/table&gt;
  </code></pre>