Is there any way to set calendar control in a web-part as readonly?

I have a custom web-part which has a Calender control. In this web-part, I am populating a SPCalendarDataSource object from a view and then this SPCalendarDataSource object is assigned to the calendar control using DataSource property.

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.DataSource = o;

I just want to disable the calender control so that user cannot add any event in this web-part by double-clicking on the calendar, or clicking on the calendar time links.

PS: I cannot set custom permission for this list to make it readonly as I am using same calendar in other web-parts where I do need add/update functionality.

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.