How to limit year in ajax calendar extender

2019-07-04 06:32发布

I have a Calendar Extender.

I want to show only current year in calendar.

User can not select 2010 as current year is 2011.

So how to do this ?

2条回答
放我归山
2楼-- · 2019-07-04 06:54

Use StartDate property of your extender. For example:

<ajax:CalendarExtender ID="Calendar" StartDate="1/1/2011" runat="server" ... /> 

StartDate - Indicates start date for range that available for selection.

查看更多
▲ chillily
3楼-- · 2019-07-04 07:00

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);
查看更多
登录 后发表回答