Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

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;
DataBind();
this.Controls.Add(calendarView);

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.

share|improve this question

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.