I have created a web part for creating new list item using VS.

Web part has a DateTime Control.

If I click on Calendar icon then it does not render it, rather gives a server error.

enter image description here

I have included TagPrefix as follows-

<%@ Register TagPrefix="SharePoint" Namespace="Microsoft.SharePoint.WebControls" Assembly="Microsoft.SharePoint, Version=, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>

and control is placed as

<SharePoint:DateTimeControl ID="dtcStartDate" runat="server"  DateOnly="True" Calendar="ChineseLunar" />

Kindly help me resolve this problem.

  • Can you copy the full error message. Commented May 20, 2015 at 16:36
  • You should consider relative or absolute path when you put DatePickerFrameUrl !
    – Blue Geek
    Commented Aug 31, 2015 at 13:35

3 Answers 3


Beware that $SPUrl is token known only in SharePoint Server editions and it is not available in SharePoint Foundation. Using $SPUrl in SharePoint Foundations throws an exception The expression prefix 'SPUrl' was not recognized

SharePoint Server:

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

SharePoint Foundation:

<SharePoint:DateTimeControl runat="server" ID="date" DatePickerFrameUrl='<%# SPContext.Current.Web.ServerRelativeUrl + "/_layouts/15/iframe.aspx" %>' />

As SharePoint:DateTimeControl Crashes in SP2013 Webpart. Try below:

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.