Link to home
Start Free TrialLog in
Avatar of colonel720
colonel720Flag for United States of America

asked on

Why is the CalendarExtender from the Ajax Control Toolkit preventing a DateTime to display correctly in a textbox?

I'm using the ajax control toolkit's CalendarExtender to provide datetimepicker functionality on a web page.
The extended control is a textbox, and the DateTime format is "MM/dd/yyyy hh:mm tt".
When the page loads, the code-behind places DateTime.Now.ToString("MM/dd/yyyy hh:mm tt") into the textbox.
Instead of seeing DateTime.Now with the correct time, I see it with 12:00 AM as the time.
so if DateTime.Now was "12/21/2008 3:34 PM", it would display as "12/21/2008 12:00 AM".
Note that when I remove the CalendarExtender the problem disappears.

The control is defined like this:
<cc1:CalendarExtender ID="dtp1" runat="server" TargetControlID="txt1" Format="MM/dd/yyyy hh:mm tt" OnClientDateSelectionChanged="function hideCalendar(cb) { cb.hide(); }" />
ASKER CERTIFIED SOLUTION
Avatar of David Robitaille
David Robitaille
Flag of Canada image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of colonel720

ASKER

Ah ok, thanks.