none
Create a calendar in c#

    Question

  • Hello,

    Does it possible to display a calendar in c# ??
    By example, I create a liste with Title, start date and end date and I want to display it.

    Thanks in advance!! :-)
    Monday, March 08, 2010 1:04 PM

Answers

  • Yes, as i mentioned, create the SPCalendarview object in your code. create items and add items collection to SPCalendarview object and add your SPCalendarvIEW Object in parents.Control place. The thing is you need to add SPCalendareView to a controls collection of your container. If your code is in a custom control, you can use this.controls and if your code is in some other place, you may use parent.controls etc. that is how it will show up on whereever your code is running.
    Moonis Tahir MVP, MCPD, MCSD.net, MCTS BizTalk 2006/SQL 2005/SharePoint Server 2007 (Dev & Config)
    • Marked as answer by Nekrofage Monday, March 15, 2010 10:15 AM
    Monday, March 08, 2010 4:41 PM

All replies

  • you can create a view on top of your list in sharepoint web browser. When you goto List settings in SharePoint, you can create new views on top of your list. When you goto create a new view, it ask you which type of view you want. In this case you can select calendar view for your list.

    However if you want to achive this using c# code, here is a very good article that has all code you need to write

    http://huynhvothinh.wordpress.com/tag/programming/

    scroll down little bit to see the calendar example with the screen shot. Basically you create a SPCalendarView object and you define  a SPCalendarItemCollection object and then you add items to this collection. at the end you set this collection object as a datasource to SPCalendarview object you created in the 1st place.


    Moonis Tahir MVP, MCPD, MCSD.net, MCTS BizTalk 2006/SQL 2005/SharePoint Server 2007 (Dev & Config)
    Monday, March 08, 2010 3:17 PM
  • Thanks Moonis !!
    There is a similar example here : http://weblogs.asp.net/gunnarpeipman/archive/2009/01/24/creating-sharepoint-global-calendar.aspx
    In these 2 cases, the calendar is add to a webpart.
    Does it possible to insert a calendar with these method without add to a webpart only in-line code ?
    Monday, March 08, 2010 4:07 PM
  • Yes, as i mentioned, create the SPCalendarview object in your code. create items and add items collection to SPCalendarview object and add your SPCalendarvIEW Object in parents.Control place. The thing is you need to add SPCalendareView to a controls collection of your container. If your code is in a custom control, you can use this.controls and if your code is in some other place, you may use parent.controls etc. that is how it will show up on whereever your code is running.
    Moonis Tahir MVP, MCPD, MCSD.net, MCTS BizTalk 2006/SQL 2005/SharePoint Server 2007 (Dev & Config)
    • Marked as answer by Nekrofage Monday, March 15, 2010 10:15 AM
    Monday, March 08, 2010 4:41 PM
  • http://social.msdn.microsoft.com/Forums/en/sharepointdevelopment/thread/4b508110-b66b-448e-8d6e-5acca5bdabce
    Thursday, January 17, 2013 5:16 PM