Click here to Skip to main content
15,868,086 members
Articles / Desktop Programming / System
Article

Calendar Extender

Rate me:
Please Sign up or sign in to vote.
0.00/5 (No votes)
11 Oct 2013CPOL1 min read 13K   1  
The AJAX Control Toolkit has a CalenderExtender extender control that pops up a calendar whenever the user clicks on the target control, or a popup

This articles was originally at wiki.asp.net but has now been given a new home on CodeProject. Editing rights for this article has been set at Bronze or above, so please go in and edit and update this article to keep it fresh and relevant.

The AJAX Control Toolkit has a CalenderExtender extender control that pops up a calendar whenever the user clicks on the target control, or a popup control.  The extender is commonly used to popup a calendar for a TextBox , like in an airline reservation system when selecting the from and to dates.  The calendar extender can work by targeting a TextBox control directly, like so:

<asp:TextBox ID="txt1" runat="server" />
<ajax:CalendarExtender ID="cal1" runat="server" PopupButtonID="txt1"  TargetControlID="txt1" />

In this mode, the calendar extender appears when the TextBox is clicked on.  Clicking out of the TextBox hides it.  (Note: This inexplicably annoying behavior was corrected with AJAX version 3.  Clicking a date now hides the calendar.) 

The extender also can take a PopupButtonID reference to a button that can be clicked.  When the button is clicked, it shows the calendar; clicking on the button again hides it.

The calendar extender can switch to year/decade view by clicking on the header.  Clicking the first time brings up a list of months; clicking again brings up a list of years.  The left and right arrow buttons also page through the months or years.

The Calendar Extendar supports localization ,and you can  localize it by setting the  EnableScriptGlobalization Script Manager property to  true , this way the calendar extendar will display its contents based on the current page culture.

 

Calendar extendar Live Demo.

This article was originally posted at http://wiki.asp.net/page.aspx/417/calendar-extender

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
United States United States
The ASP.NET Wiki was started by Scott Hanselman in February of 2008. The idea is that folks spend a lot of time trolling the blogs, googlinglive-searching for answers to common "How To" questions. There's piles of fantastic community-created and MSFT-created content out there, but if it's not found by a search engine and the right combination of keywords, it's often lost.

The ASP.NET Wiki articles moved to CodeProject in October 2013 and will live on, loved, protected and updated by the community.
This is a Collaborative Group

755 members

Comments and Discussions

 
-- There are no messages in this forum --