Click here to Skip to main content
Licence 
First Posted 30 Sep 2005
Views 191,252
Bookmarked 65 times

AJAX Date Picker for ASP.NET

By | 17 Feb 2006 | Article
AJAX Date Picker is a free ASP.NET 2.0 calendar control which utilizes AJAX techniques and requires no page postbacks.

Sample Image - AJAXDatePicker.gif

Introduction

AJAX Date Picker is a free ASP.NET 2.0 calendar control that utilizes AJAX techniques to get data from the server without an entire page postback. You can specify the clickable dates on a given month as well as other days like holidays, etc. A great application for this control is for those sites that use some reservation system to select valid dates. For example, a travel site can use this control to render only valid dates. This control limits the user on what dates to click. As a result, you have a hybrid client/server validation.

This control is free along with the source code. Feel free to modify the code to suit your needs. If you want to change the look, all you have to do is modify the Default.css file or create your own. Make sure you use the same class names. There is a property called ImageDirectory where you can specify the image directory (the default is images).

Installation

Put Ajax.dll into your bin directory. Make sure you put this code in your web.config in order to enable AJAX communications.

<httpHandlers>
    <add verb="POST,GET" path="ajax/*.ashx" 
         type="Ajax.PageHandlerFactory, Ajax" />
</httpHandlers>

Make sure you register the control on the pages where you will use it.

<%@ Register Src="AJAXDatePickerControl.ascx" 
                 TagName="AJAXDatePickerControl" TagPrefix="uc1" %>

Put ajaxMethods.cs and DatePicker.cs inside the App_Code directory.

Put AJAXDatePickerControl.ascx and AJAXDatePickerControl.ascx.cs in the root directory of the application.

You can control which dates can be selected, by modifying the ajaxMethods.cs code file under the function:

private Dates GetMonth(DateTime FromDate, DateTime ToDate)
{
    ....
}

Every time you select a month, this function gets fired asynchronously using AJAX. You can write any long running server code here. For example, you can call a web service, or query a database to get the dates.

Other Information

This control uses the Ajax.NET Library by Michael Schwarz.

Please note that I am still ironing out some features and discovering new techniques. As with all ongoing projects, this is a work in progress. Please visit my web site for more updates. Thanks.

For questions or comments, please contact me.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here

About the Author

Maynard Cuellar

Web Developer

United States United States

Member



Sign Up to vote   Poor Excellent
Add a reason or comment to your vote: x
Votes of 3 or less require a comment

Comments and Discussions

 
You must Sign In to use this message board. (secure sign-in)
 
Search this forum  
 FAQ
    Noise  Layout  Per page   
  Refresh
QuestionPic both the date and time.,IS there any control for that in ASP.net webform. PinmemberPradeep CBZ21:26 8 Apr '12  
GeneralProblem with publishing on the server Pinmembersv.marinova11:22 18 Jun '10  
GeneralRe: Problem with publishing on the server PinmemberJeff Weng17:25 28 Jun '10  
GeneralMy vote of 1 PinmemberusernameMe23:55 15 Mar '10  
GeneralMy vote of 1 Pinmemberlikki12316:58 6 Jan '09  
GeneralAjax Calendar not working Pinmembercharlesdu10122:36 22 Jul '08  
GeneralImplementing with DotNetNuke PinmemberSSwathiS3:09 4 Apr '07  
GeneralRe: Implementing with DotNetNuke Pinmemberjilucorreya20:38 20 May '07  
GeneralRe: Implementing with DotNetNuke Pinmemberjilucorreya20:43 20 May '07  
QuestionOverlapping of controls PinmemberMember #380840522:52 13 Feb '07  
GeneralDate Picker dynamicly generated problem Pinmembersursum20004:09 14 Nov '06  
GeneralCulture! Pinmembersata13374:00 7 Aug '06  
GeneralDrop Down List Problem PinmemberSoonerGoose6:28 1 Aug '06  
GeneralCan't select any dates Pinmemberjb196118:47 13 Feb '06  
GeneralRe: Can't select any dates PinmemberMaynard Cuellar2:56 14 Feb '06  
AnswerRe: Can't select any dates SOLUTION [modified] PinmemberPete Orologas17:49 22 Jun '06  
GeneralRe: Can't select any dates Pinmembersp3c135:19 14 Dec '07  
GeneralAjax Projects PinmemberHazem Torab10:56 4 Jan '06  
QuestionWhy go to server? PinmemberAlbert Einstien8:13 15 Nov '05  
Normally people make calendars so they work on the client. Why do you need to go to the server at all? Your not accessing a database so you should just write the JavaScript for it.
 
E=mc2  ->  BOOM
AnswerRe: Why go to server? PinmemberParamesh15:42 6 Jan '06  
GeneralRedundant code PinmemberVladimir_V15:41 19 Oct '05  
GeneralDoesn't work Pinmembergioker8423:34 14 Oct '05  
Questionhow about cross browser Pinmemberyararat10:30 6 Oct '05  
AnswerRe: how about cross browser Pinmemberliammclennan18:34 29 Dec '06  

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Permalink | Advertise | Privacy | Mobile
Web01 | 2.5.120529.1 | Last Updated 17 Feb 2006
Article Copyright 2005 by Maynard Cuellar
Everything else Copyright © CodeProject, 1999-2012
Terms of Use
Layout: fixed | fluid