Disable Future and Past Date Of AJAX Calendar in ASP.Net C#

contoh di .aspx

<formid=”form1″runat=”server”>
    <asp:ScriptManagerID=”ScriptManager1″runat=”server”>
    </asp:ScriptManager>
    <div  align=”center”>
        <asp:TextBox ID=”TextBox1″ runat=”server”></asp:TextBox>
        <asp:CalendarExtenderID=”Calendar1″runat=”server” 
    Enabled=”True” TargetControlID=”TextBox1″Format=”dd/MM/yyyy” ></asp:CalendarExtender>
    </div>
    </form>
pada .cs file (belakang)
To disable a past date use the following code in the “Page load”:
protected void Page_Load(object sender, EventArgs e)
{
   Calendar1.StartDate = DateTime.Now;   //to dissable past Date
}
run the ouput, output seperti di bawah
To disable a future date use the following code in the “Page load”:
protected void Page_Load(object sender, EventArgs e)

{
   Calendar1.EndDate = DateTime.Now;   //to dissable future  Date
}
output seperti di bawah