Solved

asp.net ajax tool kit calendar

Posted on 2014-02-16
4
364 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

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…
Introduction HyperText Transfer Protocol (http://www.ietf.org/rfc/rfc2616.txt) or "HTTP" is the underpinning of internet communication.  As a teacher of web development I have heard many questions, mostly from my younger students who have come to t…
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…

730 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