Click here to Skip to main content
15,905,776 members
Please Sign up or sign in to vote.
3.00/5 (2 votes)
See more:
hello everyone ,i want to set maximum number of year show from corrent year in calender control for example current year is 2014 and give maximum year 3 than show only 2014,2015,2016 years date in calender . plz help me
Posted

1 solution

Use the EndDate property of CalendarExtender control. To allow the user to select dates upto 2016, you can set the EndDate as follows:

CalendarExtender1.EndDate = new DateTime(DateTime.Today.Year + 2, 12, 31);

The above code adds 2 to the current year, which means that if current year is 2014 then it will display dates upto 2016.
 
Share this answer
 
Comments
Er. Puneet Goel 11-Mar-14 6:08am    
Yes, the answer provided above is the simplest and easiest way to restrict user to year (begin or end). For details about calender properties just click here

http://www.asp.net/ajaxlibrary/ajaxcontroltoolkitsamplesite/calendar/calendar.aspx

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900