如何限制今年阿贾克斯日历扩展日历、今年、阿贾克斯

2023-09-10 21:18:44 作者:双人超仙闺蜜 仙气十足的闺蜜昵称

我有一个日历扩展。

我要显示在日历中目前唯一的一年。

I want to show only current year in calendar.

用户不能选择2010作为本年度为2011。

User can not select 2010 as current year is 2011.

那么,如何做到这一点?

So how to do this ?

推荐答案

使用了开始日期结束日期属性设定一个范围,要允许用户选择可接受的日期 - 你可以设置在标记按照 krolik的答案,或在code-背后,所以你可以将其设置为当前年份,例如

Use the StartDate and EndDate properties to set a range of acceptable dates that you want to allow the user to select - you can set this in the markup as per krolik's answer, or in the code-behind so you can set it to the current year e.g.

CalendarExtender.StartDate = new DateTime(DateTime.Today.Year,1,1);
CalendarExtender.EndDate = new DateTime(DateTime.Today.Year,12,31);