http://www.ajaxtoolkit.net/Calendar/Calendar.aspx
1.在页面上加ScriptManager控件,不然编译不过
<asp:ScriptManager ID="ScriptManager1" runat="server"> </asp:ScriptManager>
2.在Web.config上定义namespace,tagPrefix,不然在设计页面上添加控件识别不了,如图
当然,后天添加还是可以的
<configuration> <system.web> <pages> <controls> <add tagPrefix="asp" namespace="System.Web.UI" assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/> <add tagPrefix="asp" namespace="System.Web.UI.WebControls" assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/> <add namespace="AjaxControlToolkit" assembly="AjaxControlToolkit" tagPrefix="ajaxToolkit"/> </controls> </pages> </system.web> </configuration> 3.使用日历控件时,最好用img,而不要用<asp:imageButton>控件,因为imageButton没有制止自动提交的属性UseSubmitBehavior,会导致每次回车自动拉出日历下来 <asp:TextBox ID="tbTEST" runat="server"></asp:TextBox><asp:ImageButton ID="ImgBtnTEST" runat="server" ImageUrl="images/calendar.png"/><Img src="images/calendar.png" id="ImgTEST" />
<ajaxtoolkit:calendarextender ID="CalTEST" runat="server" TargetControlID="tbTEST"
PopupButtonID = "ImgTEST" Format = "yyyy-MM-dd" CssClass="calendar"/>