SharePoint DateTimeControl Issue When Put Inside An Update Panel

Posted by Ahmed Tarek Hasan on 4/23/2013 01:25:00 PM with No comments

SharePoint DateTimeControl Issue When Put Inside An Update Panel

All credits for this post goes to my friend and colleague Mohamed Gamal


When you add a SharePoint DateTimeControl to a webpart inside an update panel and click on the date picker icon, you will receive an "Object Expected” JavaScript error.
<SharePoint:DateTimeControl ID="dtcBirthDate" runat="server" CalendarImageUrl="/_layouts/images/calendar.gif"
CssClassTextBox="itw-longDate" DateOnly="true" LocaleId="7177" ToolTip="Example: 2000-12-31"
DatePickerFrameUrl="/_layouts/iframe.aspx" />


The solution of this error is to just include the datepicker.js file explicitly on the page inside the update panel content template as follows
<script type="text/javascript" src="/_layouts/datepicker.js"></script>


That's it. Hope this will help someone someday :)



Categories: , ,