protected void Page_Load(object sender, EventArgs e)
        {
            ItemGuid = ParmParser.GetGuidIDFromQuery();

            btnCopyButton.Visible   = !(ItemGuid == Guid.Empty);
            btnDeleteButton.Visible = !(ItemGuid == Guid.Empty);
            btnCopy.Visible         = !(ItemGuid == Guid.Empty);
            btnDelete.Visible       = !(ItemGuid == Guid.Empty);

            if (!IsPostBack)
            {
                CalendarHelper.BindRepeater(rpDays, CalendarHelper.DaysOfTheWeek);

                Dictionary <Guid, string> colors = (from c in CalendarHelper.GetCalendarCategories(SiteID)
                                                    select new KeyValuePair <Guid, string>(c.CalendarEventCategoryID, string.Format("{0}|{1}", c.CategoryBGColor, c.CategoryFGColor)))
                                                   .ToDictionary(kvp => kvp.Key, kvp => kvp.Value);

                CalendarHelper.BindDropDownList(ddlColors, colors);

                var freq = CalendarFrequencyHelper.GetCalendarFrequencies();
                var cat  = CalendarHelper.GetCalendarCategories(SiteID);

                txtEventStartDate.Text = SiteData.CurrentSite.Now.ToShortDateString();
                txtEventEndDate.Text   = SiteData.CurrentSite.Now.ToShortDateString();

                CalendarHelper.BindDropDownList(ddlRecurr, freq, CalendarFrequencyHelper.GetIDByFrequencyType(CalendarFrequencyHelper.FrequencyType.Once).ToString());
                CalendarHelper.BindDropDownList(ddlCategory, cat);

                var itm = CalendarHelper.GetProfile(ItemGuid);

                if (itm != null)
                {
                    selectedDatePattern = itm.EventRepeatPattern;
                    CalendarHelper.BindRepeater(rpDays, CalendarHelper.DaysOfTheWeek);

                    txtEventTitle.Text = itm.EventTitle;
                    reContent.Text     = itm.EventDetail;

                    chkIsPublic.Checked          = itm.IsPublic;
                    chkIsAllDayEvent.Checked     = itm.IsAllDayEvent;
                    chkIsCancelled.Checked       = itm.IsCancelled;
                    chkIsCancelledPublic.Checked = itm.IsCancelledPublic;

                    txtEventStartDate.Text = itm.EventStartDate.ToShortDateString();
                    txtEventEndDate.Text   = itm.EventEndDate.ToShortDateString();

                    txtRecursEvery.Text = itm.RecursEvery.ToString();

                    CalendarHelper.SetTextboxToTimeSpan(txtEventStartTime, itm.EventStartTime);
                    CalendarHelper.SetTextboxToTimeSpan(txtEventEndTime, itm.EventEndTime);

                    ddlRecurr.SelectedValue   = itm.CalendarFrequencyID.ToString();
                    ddlCategory.SelectedValue = itm.CalendarEventCategoryID.ToString();
                }
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            ItemGuid = ParmParser.GetGuidIDFromQuery();

            if (!IsPostBack)
            {
                var itm    = CalendarHelper.GetEvent(ItemGuid);
                var itmPro = CalendarHelper.GetProfile(itm.CalendarEventProfileID);

                litTitle.Text   = itmPro.EventTitle;
                litTime.Visible = !itmPro.IsAllDayEvent;

                litTime.Text = String.Format(" {0:h:mm tt} ", CalendarHelper.GetFullDateTime(itmPro.EventStartTime));

                litDate.Text = itm.EventDate.ToShortDateString();

                CalendarHelper.SetTextboxToTimeSpan(txtEventStartTime, itm.EventStartTime);
                CalendarHelper.SetTextboxToTimeSpan(txtEventEndTime, itm.EventEndTime);

                chkIsCancelled.Checked = itm.IsCancelled;
                reContent.Text         = itm.EventDetail;
            }
        }