If somebody like the post and its helpful in your work then, add comments.

Tuesday, October 8, 2013

SharePoint 2013 : Add date and time field on your custom page

Add the date and time SharePoint control in the SharePoint 2013 hosted app.

image

Just drag and drop the controls on the page from toolbox of the VS2012

 

image

The code block will look like as follows :

<SharePoint:DateTimeControl ID="srtDate" ClientIDMode="Static" AutoPostBack="false"
                       runat="server" ToolTip="Start date for training beginning" />

But when you render this control from your app it does not load on the page, and give below screen error.(500 INTERNAL SERVER ERROR)

image
Then add the following property of the control : DatePickerFrameUrl="../_layouts/15/iframe.aspx" and add the ralative pat of the app like as I added “../”. After that it will render the control on the page.

image

4 comments:

  1. Great solution! I added my datetimecontrol in a sharepoint hosted app and I spent a lot of time to figure out was wrong, thanks!

    ReplyDelete
  2. Hi,
    What should be DatePickerFrameUrl as i am adding sharepoint datetime control programatically in my webpart.?

    ReplyDelete
    Replies
    1. Use
      DateTimeControl .DatePickerFrameUrl =SPContext.Current.Web.Url+"/_layouts/iframe.aspx ";

      Let me know if its helps?

      Delete