I have this application page with the following (simplified) markup:

<%@ Page Strict="true"  EnableViewState="true" Language="vb" MasterPageFile="~/_layouts/application.master" Inherits="Microsoft.SharePoint.WebControls.LayoutsPageBase" %>

<%@ Register Tagprefix="SharePoint" Namespace="Microsoft.SharePoint.WebControls"    Assembly="Microsoft.SharePoint, Version=, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<%@ Import Namespace="Microsoft.SharePoint" %>
<%@ Register Tagprefix="WebPartPages" Namespace="Microsoft.SharePoint.WebPartPages" Assembly="Microsoft.SharePoint, Version=, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<%@ Register Tagprefix="Utilities" Namespace="Microsoft.SharePoint.Utilities" Assembly="Microsoft.SharePoint, Version=, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<%@ Register TagPrefix="wssuc" TagName="InputFormSection" src="~/_controltemplates/InputFormSection.ascx" %> 
<%@ Register TagPrefix="wssuc" TagName="ButtonSection" src="~/_controltemplates/ButtonSection.ascx" %>

<asp:Content ID="Content1" ContentPlaceHolderID="PlaceHolderMain" runat="server" OnDemand="True" >

<SharePoint:ScriptLink Language="javascript" Name="DatePicker.js" Localizable="False" runat="server"/> 

<SharePoint:SPDatePickerControl ID="MyDate" runat="server"  LocaleId="1033" TimeZone="0" >


Essentially all that is on the page is a single control SPDatePickerControl and a ScriptLink control as the SPDatePickerControl requires DatePicker.js otherwise a JS error occurs.

When I click the left and right buttons to change the month (starting from November 2011), I see this odd behaviour:

  1. Clicking the left arrow takes me to October 2011.
  2. Clicking left again takes me back to November 2011.

  3. Clicking the Right arrow takes me to December 2011

  4. Clicking right again takes me to January 2012
  5. Clicking right again takes me to February 2012
  6. Clicking right again takes me back to November 2011.

Why? This seems very odd behaviour that I can't work out. Note that I have no code to check for postbacks at this point. Any ideas anyone?

1 Answer 1


I managed to find an answer…

After some ‘playing’ I noticed that there are two attributes that control this behaviour. They are:

StartOffset and EndOffset.

According to the SDK we have these:


[DescriptionAttribute("Value betweeen -12 and 0")] 
public int StartOffset { get; set; }


[Bin dableAttribute(true)] 
[DescriptionAttribute("Value betweeen 0 and 12")] 
public int EndOffset { get; set; }

As you can see from the above, if you don’t set these, then they default to -1 and 3 for StartOffset and EndOffset respectively. This explains the odd behaviour I experienced. So my markup becomes:

<SharePoint:SPDatePickerControl StartOffset="-12" EndOffset="12" ID="MyDate" runat="server" LocaleId="1033" ></SharePoint:SPDatePickerControl>

This gives me 12 months in either direction until the cyclic behaviour appears back to November 2011. Hopefully this answer will help someone else.

Your Answer

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

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