本文介绍了在calendarextender周末关闭的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想知道如果有一个简单的解决方案,以禁用asp.net从calendarextender周末。
I would like to know if there is a simple solution to disable weekends from calendarextender in asp.net.
我看到这一点:
结果
但它没有帮助我:
<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
<asp:CalendarExtender ID="CalendarExtender1" TargetControlID="TextBox1" OnClientShown="DisableWeekends" runat="server">
</asp:CalendarExtender>
<script type="text/javascript">
function DisableWeekends(sender, args)
{
for(var i=0; i<sender._days.all.length; i++)
{
for(var j=0; j<6; j++)
{
if(sender._days.all[i].id == "calendarValidToDate_day_"+j+"_0")
{
sender._days.all[i].disabled = true;
sender._days.all[i].innerHTML = "<div>" +sender._days.all[i].innerText+ "</div>";
}
if(sender._days.all[i].id == "calendarValidToDate_day_"+j+"_6")
{
sender._days.all[i].disabled = true;
sender._days.all[i].innerHTML = "<div>" +sender._days.all[i].innerText+ "</div>";
}
}
}
}
</script>
任何提示?
推荐答案
更改JavaScript作为像
Change your javascript as like
<script type="text/javascript">
function DisableWeekends(sender, args)
{
for(var i=0; i<sender._days.all.length; i++)
{
for(var j=0; j<6; j++)
{
if(sender._days.all[i].id == "CalendarExtender1_day_"+j+"_0")
{
sender._days.all[i].disabled = true;
sender._days.all[i].innerHTML = "<div>" +sender._days.all[i].innerText+ "</div>";
}
if(sender._days.all[i].id == "CalendarExtender1_day_"+j+"_6")
{
sender._days.all[i].disabled = true;
sender._days.all[i].innerHTML = "<div>" +sender._days.all[i].innerText+ "</div>";
}
}
}
}
您日历extendar的ID是 CalendarExtender1
,但在你的JavaScript中,您使用 calendarValidToDate
喜欢例如code !我觉得这是第一点。结果
好运:)
Your calendar extendar's ID is CalendarExtender1
, but in your javascript , you use calendarValidToDate
likes example code ! I think this is point .
Good Luck :)
这篇关于在calendarextender周末关闭的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!