예제 #1
0
파일: Schedule.cs 프로젝트: thexur/1code
        protected void FillCalendar()
        {
            CalendarTitle.Text = CalendarRelatedDate.ToString("yyyy MM");
            DateTime targetDT   = new DateTime(CalendarRelatedDate.Year, CalendarRelatedDate.Month, 1);
            int      offsetDays = (int)targetDT.DayOfWeek;

            firstDayOfTargetDateTime = targetDT.AddDays(-offsetDays);
            DateTime _dtInCell = firstDayOfTargetDateTime;

            for (int i = 0; i < columnNum * rowNum; i++)
            {
                CalendarCellControlList[i].RelatedDate = _dtInCell;
                CalendarCellControlList[i].Content.Attributes.Add("relatedDate", _dtInCell.ToString("yyyy-M-d"));
                _dtInCell = _dtInCell.AddDays(+1);
            }
            // To reduce the data source volumn of datasource, it needs DataSource to dynamically genereate the data source according to the CalendarRelatedDate in page load, rather than retrieving all the data from datasource
            this.GetData().Select(DataSourceSelectArguments.Empty, this.SelectCallback);
        }
예제 #2
0
        protected void FillCalendar()
        {
            CalendarTitle.Text = CalendarRelatedDate.ToString("yyyy MM");
            DateTime targetDT   = new DateTime(CalendarRelatedDate.Year, CalendarRelatedDate.Month, 1);
            int      offsetDays = (int)targetDT.DayOfWeek;

            firstDayOfTargetDateTime = targetDT.AddDays(-offsetDays);
            DateTime _dtInCell = firstDayOfTargetDateTime;

            for (int i = 0; i < columnNum * rowNum; i++)
            {
                CalendarCellControlList[i].RelatedDate = _dtInCell;
                CalendarCellControlList[i].Content.Attributes.Add("relatedDate", _dtInCell.ToString("yyyy-M-d"));
                _dtInCell = _dtInCell.AddDays(+1);
            }
            // 为了减少datasource的数据源列数,  DataSource需要在页面载入时
            // 根据CalendarRelatedDate动态生成数据源, 而不是从datasource中获取所有数据
            this.GetData().Select(DataSourceSelectArguments.Empty, this.SelectCallback);
        }