Solved

asp.net ajax tool kit calendar

Posted on 2014-02-16
4
360 Views
Last Modified: 2014-03-04
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.


Thanks,
0
Comment
Question by:CoolDev2014
  • 2
4 Comments
 
LVL 22

Expert Comment

by:Mrunal
ID: 39864033
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:

http://www.aspsnippets.com/Articles/Disable-Future-Dates-in-ASPNet-AJAX-Calendar-Extender-Control.aspx

Hope this helps you.
0
 

Author Comment

by:CoolDev2014
ID: 39865273
that does not help. The link you mentioned actually block all future dates.
0
 
LVL 44

Accepted Solution

by:
AndyAinscow earned 500 total points
ID: 39866613
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"))
0
 

Author Comment

by:CoolDev2014
ID: 39868986
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
0

Featured Post

Are your AD admin tools letting you down?

Managing Active Directory can get complicated.  Often, the native tools for managing AD are just not up to the task.  The largest Active Directory installations in the world have relied on one tool to manage their day-to-day administration tasks: Hyena. Start your trial today.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Entity Framework is a powerful tool to help you interact with the DataBase but still doesn't help much when we have a Stored Procedure that returns more than one resultset. The solution takes some of out-of-the-box thinking; read on!
This article aims to explain the working of CircularLogArchiver. This tool was designed to solve the buildup of log file in cases where systems do not support circular logging or where circular logging is not enabled
Along with being a a promotional video for my three-day Annielytics Dashboard Seminor, this Micro Tutorial is an intro to Google Analytics API data.
In a recent question (https://www.experts-exchange.com/questions/28997919/Pagination-in-Adobe-Acrobat.html) here at Experts Exchange, a member asked how to add page numbers to a PDF file using Adobe Acrobat XI Pro. This short video Micro Tutorial sh…

778 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