Me and my colleague are having a problem with disappearing programatically created (Calendar) list views.

After the creation of the site, the views are created correctly and are displayed in the view selector menu:

Views shown correctly

If u click on the view, its working correctly, but if u return to the previous page, all the calendar views are disappeared.

Views Gone

U can still select the views in the ribbon.

Views still in ribbon

Anyone has a solution? Thank you.

Edit: if i disable the view selector in the properties of the list view webpart and then back enable it, the views are back and shown correctly. But this doesn't solve the problem in code.

2 Answers 2


Using this code, the view stays in the view selector.

  • Calendar = name of the view that disappears
  • Events = name of the list where the view disappears


SPList listEvents = web.Lists["Events"];

foreach (SPView view in listEvents.Views)
     if (view.Title.Equals("Calendar"))
     var pageUrl = web.Url + "/"  + view.Url;
     SPLimitedWebPartManager webpartmanager = web.GetLimitedWebPartManager(pageUrl, System.Web.UI.WebControls.WebParts.PersonalizationScope.Shared);

     XsltListViewWebPart wp = webpartmanager.WebParts[0] as XsltListViewWebPart;

     wp.ViewSelectorFetchAsync = false;

Source: http://mypowershell.webnode.sk/news/calendar-view-is-missing-in-view-selector/


maybe something like this works:

          <webPart xmlns="http://schemas.microsoft.com/WebPart/v3">
                  <type name="Microsoft.SharePoint.WebPartPages.XsltListViewWebPart,Microsoft.SharePoint,Version=,Culture=neutral,PublicKeyToken=71e9bce111e9429c" />
                      <property name="DisableViewSelectorMenu" type="bool">False</property>
  • Hi, thanks for your answer. but this doesn't seem to work for me. i Don't think i can't get to the properties like this.
    – DrZoidberg
    Commented Jan 27, 2014 at 14:58

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.