在Ajax CalendarExtender中禁用日期 [英] Disable dates in Ajax CalendarExtender
本文介绍了在Ajax CalendarExtender中禁用日期的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何禁用日期大于当前日期ajax CalendarExtender。
how disable date greater than current date ajax CalendarExtender.
推荐答案
请参阅以下链接
ASP.NET AJAX日历扩展程序 - 提示与技巧
您想要的代码在该文章中说明如下:
Refer to below link
ASP.NET AJAX Calendar Extender – Tips and Tricks
The code you want is stated in that article as follows:
<head runat="server">
<title>Calendar Extender</title>
<script type="text/javascript">
function checkDate(sender,args)
{
if (sender._selectedDate > 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))
}
}
</script>
</head>
Call the code:
<form id="form1" runat="server">
<asp:scriptmanager id="ScriptManager1" runat="server" xmlns:asp="#unknown" />
<div>
<asp:textbox id="TextBox1" runat="server" xmlns:asp="#unknown"></asp:textbox>
<cc1:calendarextender id="CalendarExtender1" xmlns:cc1="#unknown">
runat="server" OnClientDateSelectionChanged="checkDate" TargetControlID="TextBox1" />
</cc1:calendarextender></div>
</form>
此外,您还可以在此链接上找到另一个示例
在Ajax CalendarExtender中禁用日期
这篇关于在Ajax CalendarExtender中禁用日期的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文