Example #1
0
        /// <summary>
        /// Raises the <see cref="E:System.Web.UI.Control.Load"/> event.
        /// </summary>
        /// <param name="e">The <see cref="T:System.EventArgs"/> object that contains the event data.</param>
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);

            if (!IsPostBack)
            {
                EnableViewMode();

                EditCalendarBox.Text = CurrentPage.PageName;
                DeleteCalendarSectionLinkButton.OnClientClick = string.Format("if(!confirm('{0}'))return false;", Translate("/common/messages/confirmdelete"));

                // Default begin date is todays date.
                CalendarList.BeginDate = DateTime.Now;
                CalendarList.DataBind();

                // MonthlyItems is a hidden calendar list used to calculate what days to highlight in CalenderView.
                // We use the first of current month as begin date but substract 6 days since CalendarView can show up to 6 days of previous month.
                MonthlyItems.BeginDate = new DateTime(CalendarView.TodaysDate.Year, CalendarView.TodaysDate.Month, 1).AddDays(-6);
                // NumberOfDaysToRender is calculated to 6 + 31 + 13 = 50.
                // 6 = CalendarView can show up to 6 days of previous month.
                // 31 = Maximum number of days in a month.
                // 13 = Calenda rView can show up to 13 days of next month.
                MonthlyItems.NumberOfDaysToRender = 50;
                MonthlyItems.DataBind();
            }

            CalendarView.SelectionChanged    += new EventHandler(CalendarView_SelectionChanged);
            CalendarView.DayRender           += new DayRenderEventHandler(CalendarView_DayRender);
            CalendarView.VisibleMonthChanged += new MonthChangedEventHandler(CalendarView_VisibleMonthChanged);
        }
Example #2
0
        /// <summary>
        /// Raises the <see cref="E:System.Web.UI.Control.Load"/> event.
        /// </summary>
        /// <param name="e">The <see cref="T:System.EventArgs"/> object that contains the event data.</param>
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);

            if (!IsPostBack)
            {
                FileList.Visible     = IsFileManagerVisibleInMenu();
                NewsListUnit.Visible = !PageReference.IsNullOrEmpty((PageReference)CurrentPage["NewsRoot"]) &&
                                       DataFactory.Instance.GetPage((PageReference)CurrentPage["NewsRoot"]).VisibleInMenu;
                CalendarList.Visible = !PageReference.IsNullOrEmpty((PageReference)CurrentPage["CalendarContainer"]) &&
                                       DataFactory.Instance.GetPage((PageReference)CurrentPage["CalendarContainer"]).VisibleInMenu;
                FileList.DataBind();
            }

            if (NewsListUnit.Visible)
            {
                NewsListUnit.DataSource = GetNewsListPages();
                NewsListUnit.DataBind();
            }

            if (CalendarList.Visible)
            {
                CalendarList.DataBind();
            }
        }
Example #3
0
 /// <summary>
 /// Setups the data for the Calendar list.
 /// </summary>
 protected void SetupData()
 {
     CalendarList.SelectedDates = CalendarView.SelectedDates;
     CalendarList.DataBind();
 }