Solved

asp.net ajax tool kit calendar

Posted on 2014-02-16
4
358 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

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Suggested Solutions

This article is for Object-Oriented Programming (OOP) beginners. An Interface contains declarations of events, indexers, methods and/or properties. Any class which implements the Interface should provide the concrete implementation for each Inter…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

708 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

12 Experts available now in Live!

Get 1:1 Help Now