I want to display a SharePoint Calendar view in my web part with some custom features. However, i cannot find any web control property about SharePoint calendar view.

For example, I want to append some div as a event to the SPCalendar day from my SQL DB.

1 Answer 1


I have not implemented it before, but you should be able to accomplish this using List View Webpart.

For Example:

private void LoadCalendar()
    string listName = "YourList";  
    string viewName = "Your View";

    SPWeb web = SPContext.Current.Web;  
    SPList list = web.Lists[listName];  
    SPView view = list.Views[viewName];  
    ListViewWebPart webPart  = new ListViewWebPart();
    webPart.ListName = list.ID.ToString("B").ToUpper();   
    webPart.ViewType = ViewType.Calendar;  
    webPart.ViewGuid = list.Views[view].ID.ToString("B").ToUpper();

And on your user control / application page:

<div id="calendarDiv" runat="server">  
  • So, i have to create a splist for this calendar, right?
    – king yau
    Commented Nov 25, 2016 at 6:17
  • Indeed, assuming you want to display data from your SharePoint list. Commented Nov 25, 2016 at 6:21

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.