예제 #1
0
        public string GetDesignTimeHtml()
        {
            HttpContext.Current.Items["CalendarViewPresentOnPage"] = 1;
            StringWriter   writer     = new StringWriter(CultureInfo.InvariantCulture);
            HtmlTextWriter output     = new HtmlTextWriter(writer);
            SPWeb          contextWeb = null;    // SPControl.GetContextWeb(this.Context);

            if (((contextWeb != null) && (this.m_ListName != null)) && (this.m_ViewGuid != null))
            {
                //CssLink.RenderSingleCssLinkFromCssRef(output, contextWeb, this.m_strCssFileName, true);
                this.EnsureChildControls();
                this.RenderChildren(output);
            }
            else
            {
                //CssLink.RenderSingleCssLinkFromCssRef(output, null, this.m_strCssFileName, true);
                MonthlyCalendarView view = new MonthlyCalendarView();
                this.SetContextSettigns(view);
                view.RenderControl(output);
            }
            return(writer.ToString());
        }
        //</Snippet2>
        //<Snippet3>
        protected void Page_Load(object sender, EventArgs e)
        {
            MonthlyCalendarView1 = new MonthlyCalendarView();
            this.Controls.Add(MonthlyCalendarView1);
            SPCalendarItemCollection items = new SPCalendarItemCollection();
            SPWeb thisWeb = SPControl.GetContextWeb(Context);

            if (CheckBoxList1.Items.Count == 0)
            {
                foreach (SPList listItem in thisWeb.Lists)
                {
                    if (listItem.BaseTemplate == SPListTemplateType.Events)
                    {
                        CheckBoxList1.Items.Add(new ListItem(listItem.Title));
                    }
                }
            }
            MonthlyCalendarView1.ItemTemplateName =
                "CalendarViewMonthItemTemplate";
            MonthlyCalendarView1.ItemAllDayTemplateName =
                "CalendarViewMonthItemAllDayTemplate";
            MonthlyCalendarView1.ItemMultiDayTemplateName =
                "CalendarViewMonthItemMultiDayTemplate";
        }