Quantcast
Channel: SharePoint 2013 - Development and Programming forum
Viewing all articles
Browse latest Browse all 7589

SharePoint DatePicker is not working in Visual webpart

$
0
0

Hi,

The sharepoint date picker is not working for Visual webparts created in VS 2012 (SP 2013).

In my visual webpart, I added the form digest, and then the sharePoint date control.

<script type="text/javascript" src="/_layouts/15/datepicker.js"></script><SharePoint:DateTimeControl ID="dtDate" runat="server"  DateOnly="true" />

I get the "/ error in Application". Many websites are saying to add the below line to the datepicker:

<SharePoint:DateTimeControl ID="dtDate" runat="server"
DateOnly="true" DatePickerFrameUrl="<%
$SPUrl:~sitecollection/_layouts/15/iframe.aspx %>" />

But adding the "DatePickerFrameUrl" gives error in the "InitializeControl()" method available in OnInit().

Error: The name InitializeControl does not exist in the current context.

I have checked this:

http://developmentsimplyput.blogspot.in/2013/04/sharepoint-datetimecontrol-issue-when.html

http://sharepoint.stackexchange.com/questions/57092/sharepointdatetimecontrol-crashes-in-sp2013-webpart

but did not solve the issue. Also creating a root site for just a DatePicker control is not an option for me.

Has anybody found a solution to this?

How to use the SharePoint datepicker in visual webpart for SP 2013?

Thanks



Viewing all articles
Browse latest Browse all 7589

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>