標籤:
1. The HTML Markup
<div> <ajaxToolkit:ToolkitScriptManager ID="ToolkitScriptManager1" runat="server"></ajaxToolkit:ToolkitScriptManager> <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox> <ajaxToolkit:CalendarExtender ID="CalendarExtender1" runat="server" TargetControlID="TextBox1" Format="yyyy/MM/dd"></ajaxToolkit:CalendarExtender> </div>
2. The Page_Load event
//disable the past date CalendarExtender1.StartDate = DateTime.Now; //disable the futhre date CalendarExtender1.EndDate = DateTime.Now; //Start Calendar after one month from the Present Date CalendarExtender1.StartDate = DateTime.Now.AddMonths(1);
More information please refer to the link below.
http://jsbin.com/rolifo/4/edit?html,output
http://www.c-sharpcorner.com/UploadFile/0c1bb2/disable-future-and-past-date-of-ajax-calendar-in-Asp-Net-C-Sharp/
使用AJAX日曆控制項,顯示某些日期(CalendarExtender)