0

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.

0

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();
    webPart.GetDesignTimeHtml();  
    this.calendarDiv.Controls.Add(webPart);
}

And on your user control / application page:

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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