I have Created a Custom Calendar webpart using SPCalendarView type. After adding this webpart to my page it is not displaying any events and the navigation buttons(two arrow buttons) for changing month/week/day and links for changing the month/week/day view is not working.

The Simple Code I used :

public partial class VisualWebPart1UserControl : UserControl
        SPCalendarView cal;
        private AudienceLoader audienceLoader = AudienceLoader.GetAudienceLoader();
        protected void Page_Load(object sender, EventArgs e)

            cal = new SPCalendarView();
            cal.Visible = true;
            cal.EnableViewState = true;
            cal.DataSource = GetItems();

    private SPCalendarItemCollection GetItems()
       var items = new SPCalendarItemCollection();
        SPCalendarItem item = null;
        item = new SPCalendarItem();

        item.ItemID = "Select";
        item.Title = "First calendar item";
        item.StartDate = DateTime.Now;
        item.EndDate = DateTime.Now.AddHours(1);
        item.hasEndDate = true;
        item.DisplayFormUrl = "/News";
        item.Location = "USA";
        item.Description = "This is the first test item in the calendar rollup";
        item.IsAllDayEvent = false;
        item.IsRecurrence = false;
        item.CalendarType = Convert.ToInt32(SPCalendarType.Gregorian);
        return items;

ScreenShot: enter image description here

The above circled controls are not working. Do anyone know the reason? And I also want the link for creating event in each grid(like in OOTB Calendar Webpart).

But, if I disable V4rendering cal.EnableV4Rendering= false; then old calendar view is displayed and everything works perfectly.

Any help would be greatly appreciated :)

1 Answer 1


You should inherit your web part from Microsoft.SharePoint.WebPartPages.WebPart, not from System.Web.UI.WebControls.WebParts.WebPart it was inherited by default.

This inheritance appends all needed javascript code and js-functions calls, and your SPCalendarView will work propertly.

So, your VisualWebPart.cs should look like this:

namespace TestCalendar.VisualWebPart1
   public class VisualWebPart1 :  Microsoft.SharePoint.WebPartPages.WebPart 
       //bla-bla-bla generated code

And look here: it's a very good answer just about your problem: https://social.msdn.microsoft.com/Forums/en-US/f10155d3-8ac6-4d8c-8c33-b4d5dbae6e2d/spcalendarview-in-sharepoint-2010-placed-on-custom-aspx-form-does-not-respond-to-any-actions?forum=sharepointdevelopmentprevious

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.