• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 384
  • Last Modified:

asp.net ajax tool kit calendar

Using ajax tool kit. how to disable or gray out particular future dates? like I will have data return from database.

03/01/2014, 03/05/2014, 12/3/2014.

  • 2
1 Solution
You can use "OnDayRender" event and add logic into that like:
protected void Calendar1_DayRender(object sender, DayRenderEventArgs e)
        if (e.Day.Date > DateTime.Today)
            e.Day.IsSelectable = false;

Open in new window

Or if you want to have this logic from client side then there is no any provision in Ajax Toolkit but you can refer this post:


Hope this helps you.
CoolDev2014Author Commented:
that does not help. The link you mentioned actually block all future dates.
AndyAinscowFreelance programmer / ConsultantCommented:
First does the code from Mrunal More almost work, by that does it block ALL future dates.
If it does then what you need to do is rather than test if the date is in the future just test if it equals one of the dates you wanted blocked.  (Note depending on what you want to block out you may wish to convert to strings and compare those)

Something like
if( (e.Day.Date == "03/01/2015") || (e.Day.Date == "28/03/2019"))
CoolDev2014Author Commented:
hmm..thank Andy. But I don't think that will work. Or I don't understand what you mean. If you can, show me how it works in codes. Thanks
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now