protected void Page_Load(object sender, EventArgs e) { if(!IsPostBack) { // Ensure we have at least one calendar. If not, let's move them back to the calendar and explain that this feature is not yet ready. var service = new CalendarService(); var calendars = service.GetCalendars(); if(calendars.First().CalendarID == 0) { Response.Redirect(URL_CALENDAR + "?status=0"); } // Ensure that, if we are editing an event, it is the backoffice owner's event. if(CalendarItemID != 0) { if(!service.ValidateCalendarItem(CalendarItemID)) { Response.Redirect(URL_CALENDARDETAILS + "?id=" + CalendarItemID); } } PopulateCalendarOptions(); PopulateCalendarItemRepeatTypeOptions(); PopulateCalendarItemTypeOptions(); PopulateDefaultFormOptions(); PopulateTimeZones(); PopulateExistingData(); } }
private void PopulateCalendarOptions() { var service = new CalendarService(); var nodes = service.GetCalendars(); lstCalendar.Items.Clear(); foreach(var node in nodes) { var item = new ListItem(); item.Text = node.Description; item.Value = node.CalendarID.ToString(); lstCalendar.Items.Add(item); } }