?
Solved

asp.net ajax tool kit calendar

Posted on 2014-02-16
4
Medium Priority
?
380 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 45

Accepted Solution

by:
AndyAinscow earned 2000 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

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Question has a verified solution.

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

International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
Integration Management Part 2
Screencast - Getting to Know the Pipeline
Suggested Courses
Course of the Month14 days, 2 hours left to enroll

807 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