Less Than Dot is a community of passionate IT professionals and enthusiasts dedicated to sharing technical knowledge, experience, and assistance. Inside you will find reference materials, interesting technical discussions, and expert tips and commentary. Once you register for an account you will have immediate access to the forums and all past articles and commentaries.
ASP.NET: Limit selections for the Calendar
From Wiki
Summary: Shows how to set the calendar control to only show certain months
Unlike the .NET windows Calendar control, the ASP.NET control doesn't allow you to set a maximum date for the control. The code below shows how you can limit the user to only go forward to a particular month (you could also adapt this example so the user can't go back beyond a previous month).
- Protected Sub Calendar1_VisibleMonthChanged(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.MonthChangedEventArgs) _
- Handles Calendar1.VisibleMonthChanged
- If e.NewDate.Year = 2007 And e.NewDate.Month = 12 Then
- Calendar1.NextMonthText = ""
- Else
- Calendar1.NextMonthText = ">"
- End If
- End Sub
This Hack is part of the ASP.NET Hacks collection



LTD Social Sitings
Note: Watch for social icons on posts by your favorite authors to follow their postings on these and other social sites.