none
SPCalendarView in sharepoint 2010 placed on custom aspx form does not respond to any actions RRS feed

  • Question

  • Hello everybody!

    We are facing strange problem when using SPCalendarView  in custom aspx form. Calendar does not cause any postback when clicking on any of its buttons. We have have used script fix (step 4) from this microsoft walkthrough and our calendar started to partially work, but it was throwing javascript exceptions in new inserted function. After function fix (semicollon missing), calendar stopped working again...

    Does anybody have any idea what can be wrong?
    Monday, July 19, 2010 6:41 AM

Answers

  • Hi,

    Sharing my detailed analysis:

     

    Code tried with SPCalendar View

    ================================

     

    using System;

    using System.Runtime.InteropServices;

    using System.Web.UI;

    using System.Web.UI.WebControls;

    using System.Web.UI.WebControls.WebParts;

    using System.Xml.Serialization;

    using Microsoft.SharePoint;

    using Microsoft.SharePoint.WebControls;

    using Microsoft.SharePoint.WebPartPages;

     

    namespace SampleWebpart1

    {

        [Guid("cf5f3fd5-1776-4c47-9587-4f6fe4f3d645")]

        public class SampleWebpart1 : Microsoft.SharePoint.WebPartPages.WebPart //System.Web.UI.WebControls.WebParts.WebPart 

     

        {

            public SampleWebpart1() { }

     

            protected override void CreateChildControls()

            {

                base.CreateChildControls();

                SharePointCalendar calendar = new SharePointCalendar();

                Controls.Add(calendar);

            }

        }

     

        public class SharePointCalendar : Control

        {

            private SPCalendarView _view;

     

            /// <summary>

            /// Create the SharePoint calendar. Uses the SharePoint SPCalendarView object.

            /// </summary>

            protected override void CreateChildControls()

            {

                base.CreateChildControls();

                _view = new SPCalendarView();

                _view.EnableViewState = true;

                _view.Width = Unit.Percentage(100);

                _view.DataSource = GetCalendarItems();

                DataBind();

                Controls.Add(_view);

            }

     

            private SPCalendarItemCollection GetCalendarItems()

            {

                // Create a new collection for the calendar items

                // This is an item with a start and end date.

                SPCalendarItemCollection items = new SPCalendarItemCollection();

     

                // Add the first dummy item

                SPCalendarItem item = new SPCalendarItem();

                item.StartDate = DateTime.Now;

                item.EndDate = DateTime.Now.AddHours(1);

                item.hasEndDate = true;

                item.Title = "First calendar item";

                item.DisplayFormUrl = "/News";

                item.Location = "India";

                item.Description = "This is the first test item in the calendar rollup";

                item.IsAllDayEvent = false;

                item.IsRecurrence = false;

                item.CalendarType = Convert.ToInt32(SPCalendarType.Gregorian);

                items.Add(item);

     

                // Add the second item. This is an all day event.

                SPCalendarItem item2 = new SPCalendarItem();

                item2.StartDate = DateTime.Now.AddDays(-1);

                item.hasEndDate = true;

                item2.Title = "Second calendar item";

                item2.DisplayFormUrl = "/News";

                item2.Location = "India";

                item2.Description = "This is the second test item in the calendar rollup";

                item2.IsAllDayEvent = true;

                item2.IsRecurrence = false;

                item2.CalendarType = Convert.ToInt32(SPCalendarType.Gregorian);

                items.Add(item2);

     

                // return the collection

                return items;

            }

        }

    }

     

     

     

    RESOLUTION/ WORKAROUND

    ========================

    1. Webpart containing SPCalendarView ; inherting from System.Web.UI.WebControls.WebParts.WebPart  has issues. The Day/ Month/Year & many more navigations & hyperlinks do not work.

     

    2. SOLUTION: Webpart containing SPCalendarView ;inherting from Microsoft.SharePoint.WebPartPages.WebPart works with no issue.

     

    NOTE: here we are not making any changes in rendering level. We still will get the v4 rendering looks.

     

     

    ROOT CAUSE

    ==========

    1. To find where the issue lies, let’s take the webpart inheriting from Microsoft.SharePoint.WebPartPages.WebPart

     

    a. When the page where webpart is added, is rendered in the browser, (Check the View source) & try finding the below method.

     

    NOTE: the method name is dynamic based on the webpart ID. The method name is built as : _spAjaxCalendarInit + WebpartId

     

    function _spAjaxCalendarInitWPQ3(){

       SP.UI.ApplicationPages.CalendarContainerFactory.create(document.getElementById('ctl00_m_g_c20623a8_a1f9_4b9a_a2f8_32fd4b34a10f_ctl01_ctl00_ctl01'),{ctxId:'WPQ3',dataSources:

    [{id:'00000000-0000-0000-0000-000000000000',name:'',color:'',formUrl:'\u002f',primary:true, disableDrag:true}],userInfo:{current:{id:'1073741823',loginName:'SHAREPOINT\

    \system',displayName:'System Account',email:''}},enablePeople:false,enableResource:false,usePostBack:true,canUserCreateItem:false,sharedPickerClientId:null,reservationContentTypeId:null,aM12String:'12:00

    am',serviceUrl:null},'month','',[{"Options":41,"Table":null,"DatePicker":null,"Dates":

    ["8/29/2010","8/30/2010","8/31/2010","9/1/2010","9/2/2010","9/3/2010","9/4/2010","9/5/2010","9/6/2010","9/7/2010","9/8/2010","9/9/2010","9/10/2010","9/11/2010","9/12/2010","9/13

    /2010","9/14/2010","9/15/2010","9/16/2010","9/17/2010","9/18/2010","9/19/2010","9/20/2010","9/21/2010","9/22/2010","9/23/2010","9/24/2010","9/25/2010","9/26/2010","9/27/2010","9

    /28/2010","9/29/2010","9/30/2010","10/1/2010","10/2/2010","10/3/2010"],"RangeJDay":[149624,149658],"Navs":null,"Items":{"Data":[[0,1,2,149650,149650,3,3,4,5,8,1,60,0,0,0,6,0],

    [0,7,2,149649,149650,8,3,4,9,8,1,1860,1,0,0,6,0]],"Strings":["","First calendar item","India","9/24/2010","8:01 am","9:01 am","/News","Second calendar item","9/23/2010","3:01

    pm"]}}]);

     }

     

    b. Note the words which have been marked as bold in the above function.

    c. Now, try finding the word: id="WebPartWPQ3"

    d. We will find the <div> section which is actually the outer webpart rendering

    e. Note one line below it (<div>) contains is: <span style="display:inline-block;width:100%;">

     

     

    2. Now, let’s check the webpart inheriting from System.Web.UI.WebControls.WebParts.WebPart 

     

    a. When the page where webpart is added, is rendered in the browser, (Check the View source) & try finding the below method.

     

    NOTE: the method name is dynamic based on the webpart ID. The method name is built as : _spAjaxCalendarInit + WebpartId

     

     function _spAjaxCalendarInitctl00_m_g_c20623a8_a1f9_4b9a_a2f8_32fd4b34a10f_ctl01(){

       SP.UI.ApplicationPages.CalendarContainerFactory.create(document.getElementById('ctl00_m_g_c20623a8_a1f9_4b9a_a2f8_32fd4b34a10f_ctl01_ctl00_ctl01'),

    {ctxId:'ctl00_m_g_c20623a8_a1f9_4b9a_a2f8_32fd4b34a10f_ctl01',dataSources:[{id:'00000000-0000-0000-0000-000000000000',name:'',color:'',formUrl:'\u002f',primary:true,

    disableDrag:true}],userInfo:{current:{id:'1073741823',loginName:'SHAREPOINT\\system',displayName:'System Account',email:''}},enablePeople:false,enableResource:false,usePostBack:true,canUserCreateItem:false,sharedPickerClientId:null,reservationContentTypeId:null,aM12String:'12:00

    am',serviceUrl:null},'month','',[{"Options":41,"Table":null,"DatePicker":null,"Dates":

    ["8/29/2010","8/30/2010","8/31/2010","9/1/2010","9/2/2010","9/3/2010","9/4/2010","9/5/2010","9/6/2010","9/7/2010","9/8/2010","9/9/2010","9/10/2010","9/11/2010","9/12/2010","9/13

    /2010","9/14/2010","9/15/2010","9/16/2010","9/17/2010","9/18/2010","9/19/2010","9/20/2010","9/21/2010","9/22/2010","9/23/2010","9/24/2010","9/25/2010","9/26/2010","9/27/2010","9

    /28/2010","9/29/2010","9/30/2010","10/1/2010","10/2/2010","10/3/2010"],"RangeJDay":[149624,149658],"Navs":null,"Items":{"Data":[[0,1,2,149650,149650,3,3,4,5,8,14,60,0,0,0,6,0],

    [0,7,2,149649,149650,8,3,4,9,8,14,1860,1,0,0,6,0]],"Strings":["","First calendar item","India","9/24/2010","8:14 am","9:14 am","/News","Second calendar item","9/23/2010","3:14

    pm"]}}]);

     }

     

     

    b. Note the words which have been marked as bold in the above function.

    c. Now, try finding the word: id="WebPartctl00_m_g_c20623a8_a1f9_4b9a_a2f8_32fd4b34a10f_ctl01". We won’t find

    d. Now, try finding the word: id="WebPartctl00_m_g_c20623a8_a1f9_4b9a_a2f8_32fd4b34a10f". We will find the <div> section which is actually the outer webpart rendering

    e. Note one line below it (<div>) contains is: <span id="ctl00_m_g_c20623a8_a1f9_4b9a_a2f8_32fd4b34a10f_ctl01" style="display:inline-block;width:100%;">

     

    ISSUE

    =====

    >> Instead of passing the DIV id that is the webpart outer section id, we are passing the Span id, so when it internally tries finding for the webpart, it will never get. And, hence it cannot register the calendar view with the webpart.

     

    >> This method contained in the file: SP.UI.ApplicationPages.Calendar.js (in the layouts folder) returns the webpart id by prefixing the webpart + the pass parameter value (what we have passed in the above method: highlighted id)

     

    SP.UI.ApplicationPages.ElementUtility.$3f = function($p0) {

     

        return $get('WebPart' + $p0);

    }

     

    >> JUST to test ONLY (NOTE: PLEASE DO NOT make any changes to OOB SharePoint files)

     

    - ADD few lines of code to check if things work here with Webpart inheriting from System.Web.UI.WebControls.WebParts.WebPart

    - In the file: SP.UI.ApplicationPages.Calendar.js (in the layouts folder)

     

    SP.UI.ApplicationPages.ElementUtility.$3f = function($p0) {              

     

       /*   ctl00_m_g_c20623a8_a1f9_4b9a_a2f8_32fd4b34a10f  is the part of webpart id. Change as per your webpart id. */

     

        if ($p0.toString().indexOf('ctl00_m_g_c20623a8_a1f9_4b9a_a2f8_32fd4b34a10f') > -1)

            return $get('WebPart' + 'ctl00_m_g_c20623a8_a1f9_4b9a_a2f8_32fd4b34a10f');

           

        return $get('WebPart' + $p0);

    }

     


    AnjaliCH-MSFT
    Friday, September 24, 2010 3:54 PM

All replies

  • I am also trying to create a Web Part from the SPCalendarView control.  I am migrating a project from SharePoint 2007 to 2010 and the control worked perfectly in 07.

    My issues so far with it are:

    1. No postbacks on any of its buttons.

    2. Even though I am binding calendar items to the data source for the control (same as I did in SP07) no events are showing up on the calendar in the browser.

    Anybody know what all has changed in this control for SP2010?

    Monday, July 19, 2010 7:42 PM
  • Hi Aroth09, this is exactly our problem

    Nobody knows something about this? Its very frustrating, we have follow all existing examples and nothing works.

    Is there in some place some real, working example about how to use spcalendarview in Sharepoint 2010  ? Somebody has managed to make it work? We would really appreciate a lot any kind of help.

    If not, what we want is to show a month calendar view, and load only filtered events from some event list. For some data reason we have to filter this data manually by code, its not possible to set some oob filter or caml query for the list. Somebody knows other way to do this?

    EDIT:

    We have found that SPCalendarView starts to partially work when we set DownLevelRendering="true" for it's properties. Events are displayed and navigation is causing postbacks with proper parameters. But in this case it seems that some javascript is missing (HighlightText method).

    Maybe this information will help somebody to recognize what can be the problem.

     

     


    Wednesday, July 21, 2010 10:37 AM
  • New update : We have tried our code in a fresh sharepoint installation with all updates installed and still is not working.

    We have tried with the spgridviewcalendar in webpart and isolated, in custom application page, in oob sharepoint page... nothing is working.

    Thursday, July 22, 2010 8:54 AM
  • Try creating an Usercontrol and place the calender in it and write all your functionality in that user control. Now create a web part which will load this usercontrol as child control and compile and deploy the same into sharepoint site. Now load this webpart and see it is working. I feel this will be an alternative for your requirement.

    follow http://bloggingabout.net/blogs/mglaser/archive/2006/11/16/Building-my-own-UserControl-WebPart-part-V.aspx to find more details.

    Let me know if you are still unable to find a solution for it.


    Regards, Nagendra
    Thursday, July 22, 2010 10:37 AM
  • Hi Nagendra, thanks for your reply, but this solution is not working. I haven't tested in Sharepoint 2007, but in Sharepoint 2010 is not working

     

    Friday, July 23, 2010 1:38 PM
  • We are doing the last attempt for solve this problem. Somebody have a working example of spcalendarview in Sharepoint 2010?

    We will be really really grateful if someone can provide some working example

    Thanks in advance.

    • Edited by Diego_BN Tuesday, July 27, 2010 12:05 PM typo
    Tuesday, July 27, 2010 12:05 PM
  • Check out this thread about the same topic http://social.msdn.microsoft.com/Forums/en-US/sharepointdevelopment/thread/0925ef18-cd32-4491-9f18-e71b17b5b6a7

    Set Enable V4 Rendering to false - the SPCalendarView will work. The rendering however will be of WSS 3.0 (non-ajax based).

    Wednesday, August 18, 2010 8:45 PM
  • Hi Dieqo,

    Is the issue resolved?


    AnjaliCH-MSFT
    Thursday, August 19, 2010 10:38 PM
  • ARoth09

     

    Thanks for the reply, but we have tried this solution and is not only that ajax is not working. Styles are not rendered and events are not rendered. Besides what we need is to use the full functionality, if the standard oob calendar is working I think it has to be some way to use the spcalendarview.

     

    Anjali  Ch

    Hi,  no, the problem is not solved. We are close to resign of this, because we have spent a lot of time and resources tryng to make the spcalendarview and nothing works. Nobody can provide a fully functional working example in SP2010, there is not documentation or information about known problems or compatibility issues... and in all this time that we have been searching we  have noticed that other people have the same problem and nobody can solve it. If SPCalendarView is not working in SP2010 and a third party control is need its ok, but at least I think that  MS has to inform about it.

     

     

    Friday, August 20, 2010 6:47 AM
  • Hi Dieqo,

    Are you able to reproduce issue in case the Webpart is inherited from Microsoft.SharePoint.WebPartPages.WebPart ? Use Microsoft namespace instead of System namespace for inheriting Webpart Class.

     

    Share your test results. 

     


    AnjaliCH-MSFT
    Wednesday, September 8, 2010 9:15 PM
  • Hi,

    Sharing my detailed analysis:

     

    Code tried with SPCalendar View

    ================================

     

    using System;

    using System.Runtime.InteropServices;

    using System.Web.UI;

    using System.Web.UI.WebControls;

    using System.Web.UI.WebControls.WebParts;

    using System.Xml.Serialization;

    using Microsoft.SharePoint;

    using Microsoft.SharePoint.WebControls;

    using Microsoft.SharePoint.WebPartPages;

     

    namespace SampleWebpart1

    {

        [Guid("cf5f3fd5-1776-4c47-9587-4f6fe4f3d645")]

        public class SampleWebpart1 : Microsoft.SharePoint.WebPartPages.WebPart //System.Web.UI.WebControls.WebParts.WebPart 

     

        {

            public SampleWebpart1() { }

     

            protected override void CreateChildControls()

            {

                base.CreateChildControls();

                SharePointCalendar calendar = new SharePointCalendar();

                Controls.Add(calendar);

            }

        }

     

        public class SharePointCalendar : Control

        {

            private SPCalendarView _view;

     

            /// <summary>

            /// Create the SharePoint calendar. Uses the SharePoint SPCalendarView object.

            /// </summary>

            protected override void CreateChildControls()

            {

                base.CreateChildControls();

                _view = new SPCalendarView();

                _view.EnableViewState = true;

                _view.Width = Unit.Percentage(100);

                _view.DataSource = GetCalendarItems();

                DataBind();

                Controls.Add(_view);

            }

     

            private SPCalendarItemCollection GetCalendarItems()

            {

                // Create a new collection for the calendar items

                // This is an item with a start and end date.

                SPCalendarItemCollection items = new SPCalendarItemCollection();

     

                // Add the first dummy item

                SPCalendarItem item = new SPCalendarItem();

                item.StartDate = DateTime.Now;

                item.EndDate = DateTime.Now.AddHours(1);

                item.hasEndDate = true;

                item.Title = "First calendar item";

                item.DisplayFormUrl = "/News";

                item.Location = "India";

                item.Description = "This is the first test item in the calendar rollup";

                item.IsAllDayEvent = false;

                item.IsRecurrence = false;

                item.CalendarType = Convert.ToInt32(SPCalendarType.Gregorian);

                items.Add(item);

     

                // Add the second item. This is an all day event.

                SPCalendarItem item2 = new SPCalendarItem();

                item2.StartDate = DateTime.Now.AddDays(-1);

                item.hasEndDate = true;

                item2.Title = "Second calendar item";

                item2.DisplayFormUrl = "/News";

                item2.Location = "India";

                item2.Description = "This is the second test item in the calendar rollup";

                item2.IsAllDayEvent = true;

                item2.IsRecurrence = false;

                item2.CalendarType = Convert.ToInt32(SPCalendarType.Gregorian);

                items.Add(item2);

     

                // return the collection

                return items;

            }

        }

    }

     

     

     

    RESOLUTION/ WORKAROUND

    ========================

    1. Webpart containing SPCalendarView ; inherting from System.Web.UI.WebControls.WebParts.WebPart  has issues. The Day/ Month/Year & many more navigations & hyperlinks do not work.

     

    2. SOLUTION: Webpart containing SPCalendarView ;inherting from Microsoft.SharePoint.WebPartPages.WebPart works with no issue.

     

    NOTE: here we are not making any changes in rendering level. We still will get the v4 rendering looks.

     

     

    ROOT CAUSE

    ==========

    1. To find where the issue lies, let’s take the webpart inheriting from Microsoft.SharePoint.WebPartPages.WebPart

     

    a. When the page where webpart is added, is rendered in the browser, (Check the View source) & try finding the below method.

     

    NOTE: the method name is dynamic based on the webpart ID. The method name is built as : _spAjaxCalendarInit + WebpartId

     

    function _spAjaxCalendarInitWPQ3(){

       SP.UI.ApplicationPages.CalendarContainerFactory.create(document.getElementById('ctl00_m_g_c20623a8_a1f9_4b9a_a2f8_32fd4b34a10f_ctl01_ctl00_ctl01'),{ctxId:'WPQ3',dataSources:

    [{id:'00000000-0000-0000-0000-000000000000',name:'',color:'',formUrl:'\u002f',primary:true, disableDrag:true}],userInfo:{current:{id:'1073741823',loginName:'SHAREPOINT\

    \system',displayName:'System Account',email:''}},enablePeople:false,enableResource:false,usePostBack:true,canUserCreateItem:false,sharedPickerClientId:null,reservationContentTypeId:null,aM12String:'12:00

    am',serviceUrl:null},'month','',[{"Options":41,"Table":null,"DatePicker":null,"Dates":

    ["8/29/2010","8/30/2010","8/31/2010","9/1/2010","9/2/2010","9/3/2010","9/4/2010","9/5/2010","9/6/2010","9/7/2010","9/8/2010","9/9/2010","9/10/2010","9/11/2010","9/12/2010","9/13

    /2010","9/14/2010","9/15/2010","9/16/2010","9/17/2010","9/18/2010","9/19/2010","9/20/2010","9/21/2010","9/22/2010","9/23/2010","9/24/2010","9/25/2010","9/26/2010","9/27/2010","9

    /28/2010","9/29/2010","9/30/2010","10/1/2010","10/2/2010","10/3/2010"],"RangeJDay":[149624,149658],"Navs":null,"Items":{"Data":[[0,1,2,149650,149650,3,3,4,5,8,1,60,0,0,0,6,0],

    [0,7,2,149649,149650,8,3,4,9,8,1,1860,1,0,0,6,0]],"Strings":["","First calendar item","India","9/24/2010","8:01 am","9:01 am","/News","Second calendar item","9/23/2010","3:01

    pm"]}}]);

     }

     

    b. Note the words which have been marked as bold in the above function.

    c. Now, try finding the word: id="WebPartWPQ3"

    d. We will find the <div> section which is actually the outer webpart rendering

    e. Note one line below it (<div>) contains is: <span style="display:inline-block;width:100%;">

     

     

    2. Now, let’s check the webpart inheriting from System.Web.UI.WebControls.WebParts.WebPart 

     

    a. When the page where webpart is added, is rendered in the browser, (Check the View source) & try finding the below method.

     

    NOTE: the method name is dynamic based on the webpart ID. The method name is built as : _spAjaxCalendarInit + WebpartId

     

     function _spAjaxCalendarInitctl00_m_g_c20623a8_a1f9_4b9a_a2f8_32fd4b34a10f_ctl01(){

       SP.UI.ApplicationPages.CalendarContainerFactory.create(document.getElementById('ctl00_m_g_c20623a8_a1f9_4b9a_a2f8_32fd4b34a10f_ctl01_ctl00_ctl01'),

    {ctxId:'ctl00_m_g_c20623a8_a1f9_4b9a_a2f8_32fd4b34a10f_ctl01',dataSources:[{id:'00000000-0000-0000-0000-000000000000',name:'',color:'',formUrl:'\u002f',primary:true,

    disableDrag:true}],userInfo:{current:{id:'1073741823',loginName:'SHAREPOINT\\system',displayName:'System Account',email:''}},enablePeople:false,enableResource:false,usePostBack:true,canUserCreateItem:false,sharedPickerClientId:null,reservationContentTypeId:null,aM12String:'12:00

    am',serviceUrl:null},'month','',[{"Options":41,"Table":null,"DatePicker":null,"Dates":

    ["8/29/2010","8/30/2010","8/31/2010","9/1/2010","9/2/2010","9/3/2010","9/4/2010","9/5/2010","9/6/2010","9/7/2010","9/8/2010","9/9/2010","9/10/2010","9/11/2010","9/12/2010","9/13

    /2010","9/14/2010","9/15/2010","9/16/2010","9/17/2010","9/18/2010","9/19/2010","9/20/2010","9/21/2010","9/22/2010","9/23/2010","9/24/2010","9/25/2010","9/26/2010","9/27/2010","9

    /28/2010","9/29/2010","9/30/2010","10/1/2010","10/2/2010","10/3/2010"],"RangeJDay":[149624,149658],"Navs":null,"Items":{"Data":[[0,1,2,149650,149650,3,3,4,5,8,14,60,0,0,0,6,0],

    [0,7,2,149649,149650,8,3,4,9,8,14,1860,1,0,0,6,0]],"Strings":["","First calendar item","India","9/24/2010","8:14 am","9:14 am","/News","Second calendar item","9/23/2010","3:14

    pm"]}}]);

     }

     

     

    b. Note the words which have been marked as bold in the above function.

    c. Now, try finding the word: id="WebPartctl00_m_g_c20623a8_a1f9_4b9a_a2f8_32fd4b34a10f_ctl01". We won’t find

    d. Now, try finding the word: id="WebPartctl00_m_g_c20623a8_a1f9_4b9a_a2f8_32fd4b34a10f". We will find the <div> section which is actually the outer webpart rendering

    e. Note one line below it (<div>) contains is: <span id="ctl00_m_g_c20623a8_a1f9_4b9a_a2f8_32fd4b34a10f_ctl01" style="display:inline-block;width:100%;">

     

    ISSUE

    =====

    >> Instead of passing the DIV id that is the webpart outer section id, we are passing the Span id, so when it internally tries finding for the webpart, it will never get. And, hence it cannot register the calendar view with the webpart.

     

    >> This method contained in the file: SP.UI.ApplicationPages.Calendar.js (in the layouts folder) returns the webpart id by prefixing the webpart + the pass parameter value (what we have passed in the above method: highlighted id)

     

    SP.UI.ApplicationPages.ElementUtility.$3f = function($p0) {

     

        return $get('WebPart' + $p0);

    }

     

    >> JUST to test ONLY (NOTE: PLEASE DO NOT make any changes to OOB SharePoint files)

     

    - ADD few lines of code to check if things work here with Webpart inheriting from System.Web.UI.WebControls.WebParts.WebPart

    - In the file: SP.UI.ApplicationPages.Calendar.js (in the layouts folder)

     

    SP.UI.ApplicationPages.ElementUtility.$3f = function($p0) {              

     

       /*   ctl00_m_g_c20623a8_a1f9_4b9a_a2f8_32fd4b34a10f  is the part of webpart id. Change as per your webpart id. */

     

        if ($p0.toString().indexOf('ctl00_m_g_c20623a8_a1f9_4b9a_a2f8_32fd4b34a10f') > -1)

            return $get('WebPart' + 'ctl00_m_g_c20623a8_a1f9_4b9a_a2f8_32fd4b34a10f');

           

        return $get('WebPart' + $p0);

    }

     


    AnjaliCH-MSFT
    Friday, September 24, 2010 3:54 PM
  • All,

    by default VisualWebPart1.cs class is inherited with System.Web.UI.WebControls.WebParts.WebPart

    you need to change it to Microsoft.SharePoint.WebPartPages.WebPart

    as given by Anjali - by doing this... it will be ajax enabled... and you dont need to set EnableV4Rendering to false...

    Also, http://www.thelineberrys.com/default-category/spcalendarview-not-working-as-expected-in-sharepoint-foundation-2010-2.html

    this guy explains how to set data source so to make sure all the buttons work...

    even after this, Day Week Month buttons don't work... for this you can do the following...

    http://www.sharepointoverflow.com/questions/6146/spcalendarview-problem-switching-between-days-weeks-sp2010

    Thursday, February 17, 2011 12:10 PM
  • CU Dec2011 ( http://support.microsoft.com/kb/2596998 ) solve all problem about SPCalendarView in SP2010.

    But remember, Webpart have to inherit from Microsoft.SharePoint.WebPartPages.WebPart.



    • Edited by pakdanan Friday, April 13, 2012 9:35 AM
    Friday, April 13, 2012 9:25 AM
  • CU Dec2011 ( http://support.microsoft.com/kb/2596998 ) solve all problem about SPCalendarView in SP2010.

    But remember, Webpart have to inherit from Microsoft.SharePoint.WebPartPages.WebPart.

    Friday, April 13, 2012 9:49 AM