ASP.NET Ajax 1.0 toolkit : Calendar Extender hide on lost focus

One of the problems with the calendar extender in the 1.0 toolkit is that if I use a button/image to show the calendar, I am forced to click on it again to hide the calendar. And imagine when you use it in a grid, the calendars seem to start piling up on one another like this.

Firefox 2+

image 

IE - 7

image 

Rather than have the end-user click on it twice to show then hide it back again, it would be simple to write a small javascript snippet that would do it for you.

<cc1:CalendarExtender ID="CalendarExtender1" TargetControlID="txtDOB" PopupPosition="BottomLeft" Animated="True" PopupButtonID="imgCalendar"
                                                   CssClass="radcalendar" FirstDayOfWeek="Default" runat="server" OnClientDateSelectionChanged="hideCalendar" >
                                               </cc1:CalendarExtender>
this.Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "hideCalendar", @"function hideCalendar(calExtender) { calExtender.hide(); }", true);

One way to add this script is to add it for all the pages that use the calendar control, else you can just add it to the common.js that one would add to all the pages/just the masterpage of your asp.net application.

Published Sunday, May 18, 2008 9:57 PM by sashidhar

Comments

# ASP.NET Ajax 1.0 toolkit : Calendar Extender hide on lost focus - Sashidhar Kokku's blog

Pingback from  ASP.NET Ajax 1.0 toolkit : Calendar Extender hide on lost focus - Sashidhar Kokku's blog

# ?????????weblog &raquo; Blog Archive &raquo; ??????????????????

Tuesday, June 03, 2008 7:42 AM by ?????????weblog » Blog Archive » ??????????????????

Pingback from  ?????????weblog &raquo; Blog Archive   &raquo; ??????????????????

# re: ASP.NET Ajax 1.0 toolkit : Calendar Extender hide on lost focus

Wednesday, July 30, 2008 4:27 AM by help

Make sure you are using an ImageButton and not just an Image if you encounter this problem as detailed here forums.asp.net/.../1182269.aspx

Leave a Comment

(required) 
(required) 
(optional)
(required)