Home » Sharepoint

sharepoint 2010 calendar list ajax events


it seems that sharepoint 2010 calendar list uses ajax events to navigate between months. my problem is that i want to load some data on month change event and populate it on calendar but i don't know how to hook into these ajax events, if any one knows please help me. what i know it calls some ajax services to change months.


7 Answers Found


Answer 1

Hi Rohit,

The calendar  List  has the webpart (calendar) which renders inside the list. This webpart is ajax  enabled. The navigation (previous/next) month makes the postback n updates the webpart.

Now, what exactly is your requirement. What we want to achive when we click on previous/Next month navigations ?



Answer 2

Thanks your your reply anjali.

problem is that we had developed our custom webpart in SP 2007 which contains calendar  list and added this on SP site. in MOSS it uses to work fine as navigation between months used to cause a full post back to page and our custom data population logic inside webpart was getting executed properly because it was loading entire web part on navigation. however in SP 2010 when we added this webpart first time it works fine because of full post back but when we navigate between months it does not cause load of our webpart and hence we are not able to populate our data in calendar list. i looked through fiddler and it calls .ashx service for navigation between months but i am not sure how to fit my requirement in this. i appreciate it may be due to poor design but i need to make it work in 2010.


Answer 3

Hi Rohit,

In SharePoint 2010,  all WebParts are Ajax enabled, so there won’t be any subsequent postbacks. We have to make changes in our current code to meet with the design of SP 2010

Following seems to be the sequence of the javascript call, when we click on the prev/next navigation (to  switch between months)

function MoveToDate =>Init.js
function CoreInvoke =>Init.js
function _MoveToDate =>core.js
function _MoveToViewDate =>core.js
function AjaxCalendarCall

Now, we need to hook your code, somewhere in these calling methods to know if postback is happening (Make sure we do not change OOB files & do it in a supported way).


Answer 4

Hi Anjali,

thanks a lot for your reply.

could you please suggest some supported ways of doing this?


Answer 5

one more question, can i achieve this if i inherit SPCalendarView and trap this navigation?

Answer 6

Hi Rohit,

I havent tried using the SPCalendarView, so I am not sure about the output. Post the results, in case you get chance to test it. Shall be helpful for further references.



Answer 7

Has anyone been able to successfully do this?

Also I am having an issue manually creating a SPCalendarItemCollection and then binding it as the data source on the SPCalendarView object.  No calendar  events show up.

I am porting a calendar web part over from sharepoint  2007 and was successfully able to do this then.

Also are people having issues with the Ajax calls not working. ie. moving between months and views does not work?

I was able to get it working by adding this script into my webpart but this does not seem like the correct way to go about it.


 private void EnsurePanelFix()


            if (this.Page.Form != null)


                String fixupScript = @"


                     function _initFormActionAjax()


                       if (_spEscapedFormAction == document.forms[0].action)


                         document.forms[0]._initialAction = 




                     var RestoreToOriginalFormActionCore = 


                     RestoreToOriginalFormAction = function()


                       if (_spOriginalFormAction != null)



                         document.forms[0]._initialAction = 





                  typeof(CalendarWidget), "UpdatePanelFixup",

                  fixupScript, true);





<< Previous      Next >>

Microsoft   |   Windows   |   Visual Studio   |   Sharepoint   |   Azure