We are using SPCalendarView inside a custom web-part to show events. I am now trying to implement a new functionality to show various calenders for different locations (e.g NYC, London, New Delhi etc.).

Here is the code snippet:

SPCalendarView calendarView;
calendarView.DisplayItemFormUrl = SPContext.Current.Web.Lists["Calendar"].DefaultDisplayFormUrl;
calendarView.ViewGuid = list.Views["All Events"];
calendarView.ListName = web.Lists["Calendar"].ID.ToString();

SPCalendarDataSource o = new SPCalendarDataSource();
o.List = SPControl.GetContextWeb(HttpContext.Current).Lists[new Guid(list.ID.ToString())];
o.View = o.List.GetView(new Guid(list.Views["All Events"].ID.ToString()));

calendarView.RegionalSettings.TimeZone.ID = 2   //(GMT) Greenwich Mean Time : Dublin, Edinburgh, Lisbon, London

calendarView.DataSource = o;

On page refresh, everything is working just fine and calendar is showing all events based on London timezone.

Problem is when user clicks on "Next Day" button of the calendar, SPCalendarView looses this TimeZone value and instead it picking up User's timezone. In Firebug I can see SPCalendarView is making AJAX call to http://sp/_layouts/CalendarService.ashx to fetch events for the next day and hence I lose the timezone value set.

So my questions are: 1. Is it really possible in SharePoint to set timezone of SPCalendarView through code which also work with next/prev days click events. 2. If not, then can I change next/prev day click event to call my own web service instead? 3. If not, then is it possible to post back the page on next/prev days click events in SPCalendarView control?

Thank you in advance for your help. Please do post your reply even if you have any other workaround to fix this issue.

[UPDATE] Here is SPCalendarView's AJAX call



Your Answer

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

Browse other questions tagged or ask your own question.