Click here to Skip to main content
15,867,771 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I need to grey out the future dates (dates beyond today's date) in ajaxcontroltoolkit calendarextender control. How can I achieve this? I have been able to do as much that the user is not able to select future dates from the calendarextender control but I wish to grey out the future dates for visual clue that these dates are not selectable.

Do not want disable date as cut, I need to gray(disable) future dates
Thanks in advance.
Posted

Try this


C#
CalendarExtender1.EndDate = DateTime.Now;


to change the style you can change style in

ajax__calendar_invalid class in the css
 
Share this answer
 
v2
Override the day render function.

VB
Private Sub Calendar1_DayRender(sender As Object, e As DayRenderEventArgs)

   If e.Day.Date > EndOfDateRange Then
     e.Cell.BackColor = System.Drawing.Color.LightGray
     e.Day.IsSelectable = False
   End If
End Sub
 
Share this answer
 

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