Calendar control - Restrict Next OR Previous Months HyperLink

Posted on 2005-04-22
Last Modified: 2012-06-21

I have a ASP.NET Calendar control displaying dates. Using the date render function, I restrict the days selectable for the earliest or latest days.

For example, If the earliest date is March 15, I just show grayed out dates for all days up to March 14.

I would like to add to this functionality by removing the "Previous Month" Hyperlink, so the user doesn't keep hitting back and get lost. Conversely, I would like to remove the "Next Month" Link when the user reaches a month where the day equals the upper limit.

Is there a way to dynamically remove either the Next Month OR Previous Month links from a calendar control, depending on what limit is reached?

Thanks in advance...
Question by:prodier
    LVL 13

    Expert Comment

    Have you tried Calendar1.ShowNextPrevMonth = False ?
    LVL 6

    Accepted Solution

    In Calendar_VisibleMonthChanged event, you can check for e.NewDate.Month & e.NewDate.Year and make the Calendar.PrevMonthText = "" & Calendar.NextMonthText = "" for the dates you want to hide.

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Threat Intelligence Starter Resources

    Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

    AJAX ModalPopupExtender has a required property "TargetControlID" which may seem to be very confusing to new users. It means the server control that will be extended by the ModalPopup, for instance, if when you click a button, a ModalPopup displays,…
    In .NET 2.0, Microsoft introduced the Web Site.  This was the default way to create a web Project in Visual Studio 2005.  In Visual Studio 2008, the Web Application has been restored as the default web Project in Visual Studio/.NET 3.x The Web Si…
    how to add IIS SMTP to handle application/Scanner relays into office 365.
    This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor ( If you're looking for how to monitor bandwidth using netflow or packet s…

    761 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    8 Experts available now in Live!

    Get 1:1 Help Now