Monday 4 February 2008

Asp.Net Ajax Calendar Extender

There is a bug with the AJAX calendar extender in that the style of the popup calendar are not applied if the text-box /calendar extender are hidden when a page first loads.

e.g. Panel with Details on is only shown once valid record found; if the first calendar extender on the page is within this hidden Details panel the calendar will not be displayed correctly when Details does become visible:

image

To fix this have a hidden calendar extender at top of the page:

<!-- Workaround for Calendar not displaying correctly - if hidden when page first loads -->
<div style="display: none"><asp:TextBox runat="server" ID="textbox1" /><cc1:CalendarExtender ID="ceTextBox1" runat="server" TargetControlID="textbox1" /></div>


Calendar is then displayed correctly:



image