Ejemplo n.º 1
0
        void WriteDay(DateTime date, HtmlTextWriter writer, bool enabled)
        {
            TableItemStyle style = new TableItemStyle();
            TableCell      cell  = new TableCell();

            CalendarDay day = new CalendarDay(date,
                                              IsWeekEnd(date.DayOfWeek),
                                              date == TodaysDate, SelectedDates.Contains(date),
                                              GetGlobalCalendar().GetMonth(DisplayDate) != GetGlobalCalendar().GetMonth(date),
                                              date.Day.ToString());

            day.IsSelectable     = SelectionMode != CalendarSelectionMode.None;
            cell.HorizontalAlign = HorizontalAlign.Center;
            cell.Width           = Unit.Percentage(GetCellWidth());

            LiteralControl lit = new LiteralControl(day.DayNumberText);

            cell.Controls.Add(lit);

            OnDayRender(cell, day);

            if (dayStyle != null && !dayStyle.IsEmpty)
            {
                style.CopyFrom(dayStyle);
            }

            if (day.IsWeekend && weekendDayStyle != null && !weekendDayStyle.IsEmpty)
            {
                style.CopyFrom(weekendDayStyle);
            }

            if (day.IsToday && todayDayStyle != null && !todayDayStyle.IsEmpty)
            {
                style.CopyFrom(todayDayStyle);
            }

            if (day.IsOtherMonth && otherMonthDayStyle != null && !otherMonthDayStyle.IsEmpty)
            {
                style.CopyFrom(otherMonthDayStyle);
            }

            if (enabled && day.IsSelected)
            {
                style.BackColor = Color.Silver;
                style.ForeColor = Color.White;
                if (selectedDayStyle != null && !selectedDayStyle.IsEmpty)
                {
                    style.CopyFrom(selectedDayStyle);
                }
            }

            cell.ApplyStyle(style);

            lit.Text = BuildLink(GetDaysFromZenith(date).ToString(), day.DayNumberText,
                                 cell.ForeColor, enabled && day.IsSelectable);

            cell.RenderControl(writer);
        }
 private void RenderErrorMessage(HtmlTextWriter writer) {
     if (_displayErrorMessage) {
         writer.RenderBeginTag(HtmlTextWriterTag.Tr);
         TableCell td = new TableCell();
         td.ApplyStyle(ErrorStyle);
         td.Text = NewConnectionErrorMessage;
         td.RenderControl(writer);
         writer.RenderEndTag();
     }
 }
 private void RenderErrorMessage(HtmlTextWriter writer)
 {
     if (this._displayErrorMessage)
     {
         writer.RenderBeginTag(HtmlTextWriterTag.Tr);
         TableCell cell = new TableCell();
         cell.ApplyStyle(base.ErrorStyle);
         cell.Text = this.NewConnectionErrorMessage;
         cell.RenderControl(writer);
         writer.RenderEndTag();
     }
 }
Ejemplo n.º 4
0
		void WriteDay (DateTime date, HtmlTextWriter writer)
		{			
			TableItemStyle style = new TableItemStyle ();
			TableCell cell = new TableCell ();

			CalendarDay day = new CalendarDay (date,
				IsWeekEnd (date.DayOfWeek),
				date == TodaysDate, SelectedDates.Contains (date),
				GetGlobalCalendar ().GetMonth (DisplayDate) != GetGlobalCalendar ().GetMonth (date),
				date.Day.ToString ());

			day.IsSelectable = SelectionMode != CalendarSelectionMode.None;
			cell.HorizontalAlign = HorizontalAlign.Center;
			cell.Width = Unit.Percentage (GetCellWidth ());

			LiteralControl lit = new LiteralControl (day.DayNumberText);
			cell.Controls.Add (lit);

			OnDayRender (cell, day);
					
			if (dayStyle != null && !dayStyle.IsEmpty) {
				style.CopyFrom (dayStyle);
			}

			if (day.IsWeekend && weekendDayStyle != null && !weekendDayStyle.IsEmpty) {
				style.CopyFrom (weekendDayStyle);
			}

			if (day.IsToday && todayDayStyle != null && !todayDayStyle.IsEmpty) {
				style.CopyFrom (todayDayStyle);
			}

			if (day.IsOtherMonth && otherMonthDayStyle != null && !otherMonthDayStyle.IsEmpty) {
				style.CopyFrom (otherMonthDayStyle);
			}

			if (day.IsSelected && Enabled) {
				style.BackColor = Color.Silver;
				style.ForeColor = Color.White;
				if (selectedDayStyle != null && !selectedDayStyle.IsEmpty) {
					style.CopyFrom (selectedDayStyle);
				}
			}

			cell.ApplyStyle (style);

			lit.Text = BuildLink (GetDaysFromZenith (date).ToString (), day.DayNumberText,
					      cell.ForeColor, day.IsSelectable && Enabled);

			cell.RenderControl (writer);
		}
 private void RenderDays(HtmlTextWriter writer, DateTime firstDay, DateTime visibleDate, CalendarSelectionMode selectionMode, bool buttonsActive, bool useAccessibleHeader)
 {
     Unit unit;
     DateTime time = firstDay;
     TableItemStyle style = null;
     bool flag = this.HasWeekSelectors(selectionMode);
     if (flag)
     {
         style = new TableItemStyle {
             Width = Unit.Percentage(12.0),
             HorizontalAlign = HorizontalAlign.Center
         };
         style.CopyFrom(this.SelectorStyle);
         unit = Unit.Percentage(12.0);
     }
     else
     {
         unit = Unit.Percentage(14.0);
     }
     bool flag2 = !(this.threadCalendar is HebrewCalendar);
     bool flag3 = (base.GetType() != typeof(System.Web.UI.WebControls.Calendar)) || (base.Events[EventDayRender] != null);
     TableItemStyle[] styleArray = new TableItemStyle[0x10];
     int definedStyleMask = this.GetDefinedStyleMask();
     DateTime todaysDate = this.TodaysDate;
     string selectWeekText = this.SelectWeekText;
     bool hasButton = buttonsActive && (selectionMode != CalendarSelectionMode.None);
     int month = this.threadCalendar.GetMonth(visibleDate);
     int days = firstDay.Subtract(baseDate).Days;
     bool flag5 = base.DesignMode && (this.SelectionMode != CalendarSelectionMode.None);
     int num4 = 0;
     if (this.IsMinSupportedYearMonth(visibleDate))
     {
         num4 = ((int) this.threadCalendar.GetDayOfWeek(firstDay)) - this.NumericFirstDayOfWeek();
         if (num4 < 0)
         {
             num4 += 7;
         }
     }
     bool flag6 = false;
     DateTime time3 = this.threadCalendar.AddMonths(this.maxSupportedDate, -1);
     bool flag7 = this.IsMaxSupportedYearMonth(visibleDate) || this.IsTheSameYearMonth(time3, visibleDate);
     for (int i = 0; i < 6; i++)
     {
         if (flag6)
         {
             return;
         }
         writer.Write("<tr>");
         if (flag)
         {
             int num6 = (days * 100) + 7;
             if (num4 > 0)
             {
                 num6 -= num4;
             }
             else if (flag7)
             {
                 int num7 = this.maxSupportedDate.Subtract(time).Days;
                 if (num7 < 6)
                 {
                     num6 -= 6 - num7;
                 }
             }
             string eventArgument = "R" + num6.ToString(CultureInfo.InvariantCulture);
             string title = null;
             if (useAccessibleHeader)
             {
                 int num8 = i + 1;
                 title = System.Web.SR.GetString("Calendar_SelectWeekTitle", new object[] { num8.ToString(CultureInfo.InvariantCulture) });
             }
             this.RenderCalendarCell(writer, style, selectWeekText, title, buttonsActive, eventArgument);
         }
         for (int j = 0; j < 7; j++)
         {
             string str4;
             if (num4 > 0)
             {
                 j += num4;
                 while (num4 > 0)
                 {
                     writer.RenderBeginTag(HtmlTextWriterTag.Td);
                     writer.RenderEndTag();
                     num4--;
                 }
             }
             else if (flag6)
             {
                 while (j < 7)
                 {
                     writer.RenderBeginTag(HtmlTextWriterTag.Td);
                     writer.RenderEndTag();
                     j++;
                 }
                 break;
             }
             int dayOfWeek = (int) this.threadCalendar.GetDayOfWeek(time);
             int dayOfMonth = this.threadCalendar.GetDayOfMonth(time);
             if ((dayOfMonth <= 0x1f) && flag2)
             {
                 str4 = cachedNumbers[dayOfMonth];
             }
             else
             {
                 str4 = time.ToString("dd", CultureInfo.CurrentCulture);
             }
             CalendarDay day = new CalendarDay(time, (dayOfWeek == 0) || (dayOfWeek == 6), time.Equals(todaysDate), (this.selectedDates != null) && this.selectedDates.Contains(time), this.threadCalendar.GetMonth(time) != month, str4);
             int num12 = 0x10;
             if (day.IsSelected)
             {
                 num12 |= 8;
             }
             if (day.IsOtherMonth)
             {
                 num12 |= 2;
             }
             if (day.IsToday)
             {
                 num12 |= 4;
             }
             if (day.IsWeekend)
             {
                 num12 |= 1;
             }
             int styleMask = definedStyleMask & num12;
             int index = styleMask & 15;
             TableItemStyle style2 = styleArray[index];
             if (style2 == null)
             {
                 style2 = new TableItemStyle();
                 this.SetDayStyles(style2, styleMask, unit);
                 styleArray[index] = style2;
             }
             string str5 = null;
             if (useAccessibleHeader)
             {
                 str5 = time.ToString("m", CultureInfo.CurrentCulture);
             }
             if (flag3)
             {
                 TableCell cell = new TableCell();
                 cell.ApplyStyle(style2);
                 LiteralControl child = new LiteralControl(str4);
                 cell.Controls.Add(child);
                 day.IsSelectable = hasButton;
                 this.OnDayRender(cell, day);
                 child.Text = this.GetCalendarButtonText(days.ToString(CultureInfo.InvariantCulture), str4, str5, buttonsActive && day.IsSelectable, cell.ForeColor);
                 cell.RenderControl(writer);
             }
             else
             {
                 if (flag5 && style2.ForeColor.IsEmpty)
                 {
                     style2.ForeColor = this.defaultForeColor;
                 }
                 this.RenderCalendarCell(writer, style2, str4, str5, hasButton, days.ToString(CultureInfo.InvariantCulture));
             }
             if ((flag7 && (time.Month == this.maxSupportedDate.Month)) && (time.Day == this.maxSupportedDate.Day))
             {
                 flag6 = true;
             }
             else
             {
                 time = this.threadCalendar.AddDays(time, 1);
                 days++;
             }
         }
         writer.Write("</tr>");
     }
 }
Ejemplo n.º 6
0
		private void RenderAllDays (HtmlTextWriter writer,
					    DateTime firstDay,
					    DateTime activeDate,
					    CalendarSelectionMode mode,
					    bool isActive,
					    bool isDownLevel)
		{
			TableItemStyle weeksStyle = null;
			TableCell weeksCell = new TableCell ();
			TableItemStyle weekendStyle = WeekendDayStyle;
			TableItemStyle otherMonthStyle = OtherMonthDayStyle;
			Unit size;
			bool isWeekMode = (mode == CalendarSelectionMode.DayWeek ||
					   mode == CalendarSelectionMode.DayWeekMonth);

			if (isWeekMode) {
				weeksStyle = new TableItemStyle ();
				weeksStyle.Width = Unit.Percentage (12);
				weeksStyle.HorizontalAlign = HorizontalAlign.Center;
				weeksStyle.CopyFrom (SelectorStyle);
				size = Unit.Percentage (12);
			} else {
				size = Unit.Percentage (14);
			}

			TableItemStyle [] styles = new TableItemStyle [32];
			int definedStyles = MASK_SELECTED;
			if (weekendStyle != null && !weekendStyle.IsEmpty)
				definedStyles |= MASK_WEEKEND;
			if (otherMonthStyle != null && !otherMonthStyle.IsEmpty)
				definedStyles |= MASK_OMONTH;
			if (todayDayStyle != null && !todayDayStyle.IsEmpty)
				definedStyles |= MASK_TODAY;
			if (dayStyle != null && !dayStyle.IsEmpty)
				definedStyles |= MASK_DAY;

			int month = globCal.GetMonth (activeDate);
			DateTime currentDay = firstDay;
			int begin = (int) (firstDay - begin_date).TotalDays;
			for (int crr = 0; crr < 6; crr++) {
				writer.Write ("<tr>");
				if (isWeekMode) {
					int week_offset = begin + crr * 7;
					string cellText = GetCalendarLinkText (
								"R" + week_offset + "07",
								SelectWeekText, 
								"Select week " + (crr + 1),
								weeksCell.ForeColor,
								isActive);

					weeksCell.Text = cellText;
					weeksCell.ApplyStyle (weeksStyle);
					RenderCalendarCell (writer, weeksCell, cellText);
				}

				for (int weekDay = 0; weekDay < 7; weekDay++) {
					string dayString = currentDay.Day.ToString ();
					DayOfWeek dow = currentDay.DayOfWeek;
					CalendarDay calDay =
						new CalendarDay (
								currentDay,
								dow == DayOfWeek.Sunday ||
								dow == DayOfWeek.Saturday,
								currentDay == TodaysDate, 
								SelectedDates.Contains (currentDay),
								globCal.GetMonth (currentDay) != month,
								dayString
								);


					int dayStyles = GetMask (calDay) & definedStyles;
					TableItemStyle currentDayStyle = styles [dayStyles];
					if (currentDayStyle == null) {
						currentDayStyle = new TableItemStyle ();
						if ((dayStyles & MASK_DAY) != 0)
							currentDayStyle.CopyFrom (DayStyle);

						if ((dayStyles & MASK_WEEKEND) != 0)
							currentDayStyle.CopyFrom (WeekendDayStyle);

						if ((dayStyles & MASK_TODAY) != 0)
							currentDayStyle.CopyFrom (TodayDayStyle);

						if ((dayStyles & MASK_OMONTH) != 0)
							currentDayStyle.CopyFrom (OtherMonthDayStyle);

						if ((dayStyles & MASK_SELECTED) != 0) {
							currentDayStyle.ForeColor = Color.White;
							currentDayStyle.BackColor = Color.Silver;
							currentDayStyle.CopyFrom (SelectedDayStyle);
						}

						currentDayStyle.Width = size;
						currentDayStyle.HorizontalAlign = HorizontalAlign.Center;
					}

					TableCell dayCell = new TableCell ();
					dayCell.ApplyStyle (currentDayStyle);
					LiteralControl number = new LiteralControl (dayString);
					dayCell.Controls.Add (number);
					calDay.IsSelectable = isActive;
					OnDayRender (dayCell, calDay);
					if (calDay.IsSelectable)
						number.Text = GetCalendarLinkText ((begin + (crr * 7 + weekDay)).ToString (),
									dayString,
									currentDay.ToShortDateString (),
									dayCell.ForeColor,
									isActive);

					dayCell.RenderControl (writer);
					currentDay = globCal.AddDays (currentDay, 1);
				}
				writer.Write("</tr>");
			}
		}
Ejemplo n.º 7
0
        /// <summary>
        /// Renders a table cell of a given toolbar item.
        /// </summary>
        /// <param name="item">Item to be rendered.</param>
        /// <param name="writer">Writer that streams output to the client.</param>
        protected void RenderItemCell(ToolbarItem item, HtmlTextWriter writer)
        {
            TableCell cell = new TableCell();
            cell.HorizontalAlign = item.HorizontalAlign;
            cell.VerticalAlign = item.VerticalAlign;

            if (item is ToolbarSeparator)
            {
                //set separator height (custom if set or toolbar property)
                if (this.Orientation == ToolbarOrientation.Horizontal)
                    //set the cell width on a horizontal toolbar
                    cell.Width = item.ItemCellDistance == Unit.Empty ? this.SeparatorCellDistance : item.ItemCellDistance;
                else
                    //set the cell height on a vertical toolbar
                    cell.Height = item.ItemCellDistance == Unit.Empty ? this.SeparatorCellDistance : item.ItemCellDistance;

                if (this.SeparatorImageUrl != String.Empty)
                {
                    Image img = new Image();
                    img.ImageUrl = this.SeparatorImageUrl;
                    cell.Controls.Add(img);
                }
                else
                {
                    cell.Text = "&nbsp;";
                }
                cell.RenderControl(writer);
            }
            else
            {
                if (this.Orientation == ToolbarOrientation.Horizontal)
                    //set the cell width on a horizontal toolbar
                    cell.Width = item.ItemCellDistance == Unit.Empty ? this.ItemCellDistance : item.ItemCellDistance;
                else
                    //set the cell height on a vertical toolbar
                    cell.Height = item.ItemCellDistance == Unit.Empty ? this.ItemCellDistance : item.ItemCellDistance;

                //render the item
                cell.RenderBeginTag(writer);
                item.RenderControl(writer);
                cell.RenderEndTag(writer);
            }
        }
Ejemplo n.º 8
0
        /// <devdoc>
        /// </devdoc>
        private void RenderDays(HtmlTextWriter writer, DateTime firstDay, DateTime visibleDate, CalendarSelectionMode selectionMode, bool buttonsActive, bool useAccessibleHeader) {
            // Now add the rows for the actual days

            DateTime d = firstDay;
            TableItemStyle weekSelectorStyle = null;
            Unit defaultWidth;
            bool hasWeekSelectors = HasWeekSelectors(selectionMode);
            if (hasWeekSelectors) {
                weekSelectorStyle = new TableItemStyle();
                weekSelectorStyle.Width = Unit.Percentage(12);
                weekSelectorStyle.HorizontalAlign = HorizontalAlign.Center;
                weekSelectorStyle.CopyFrom(SelectorStyle);
                defaultWidth = Unit.Percentage(12);
            }
            else {
                defaultWidth = Unit.Percentage(14);
            }

            // This determines whether we need to call DateTime.ToString for each day. The only culture/calendar
            // that requires this for now is the HebrewCalendar.
            bool usesStandardDayDigits = !(threadCalendar is HebrewCalendar);

            // This determines whether we can write out cells directly, or whether we have to create whole
            // TableCell objects for each day.
            bool hasRenderEvent = (this.GetType() != typeof(Calendar)
                                   || Events[EventDayRender] != null);

            TableItemStyle [] cellStyles = new TableItemStyle[16];
            int definedStyleMask = GetDefinedStyleMask();
            DateTime todaysDate = TodaysDate;
            string selectWeekText = SelectWeekText;
            bool daysSelectable = buttonsActive && (selectionMode != CalendarSelectionMode.None);
            int visibleDateMonth = threadCalendar.GetMonth(visibleDate);
            int absoluteDay = firstDay.Subtract(baseDate).Days;

            // VSWhidbey 480155: flag to indicate if forecolor needs to be set
            // explicitly in design mode to mimic runtime rendering with the
            // limitation of not supporting CSS class color setting.
            bool inDesignSelectionMode = (DesignMode && SelectionMode != CalendarSelectionMode.None);

            //------------------------------------------------------------------
            // VSWhidbey 366243: The following variables are for boundary cases
            // such as the current visible month is the first or the last
            // supported month.  They are used in the 'for' loops below.

            // For the first supported month, calculate how many days to
            // skip at the beginning of the first month.  E.g. JapaneseCalendar
            // starts at Sept 8.
            int numOfFirstDaysToSkip = 0;
            if (IsMinSupportedYearMonth(visibleDate)) {
                numOfFirstDaysToSkip = (int)threadCalendar.GetDayOfWeek(firstDay) - NumericFirstDayOfWeek();
                // If negative, it simply means the the index of the starting
                // day name is greater than the day name of the first supported
                // date.  We add back 7 to get the number of days to skip.
                if (numOfFirstDaysToSkip < 0) {
                    numOfFirstDaysToSkip += 7;
                }
            }
            Debug.Assert(numOfFirstDaysToSkip < 7);

            // For the last or second last supported month, initialize variables
            // to identify the last supported date of the current calendar.
            // e.g. The last supported date of HijriCalendar is April 3.  When
            // the second last monthh is shown, it can be the case that not all
            // cells will be filled up.
            bool passedLastSupportedDate = false;
            DateTime secondLastMonth = threadCalendar.AddMonths(maxSupportedDate, -1);
            bool lastOrSecondLastMonth = (IsMaxSupportedYearMonth(visibleDate) ||
                                IsTheSameYearMonth(secondLastMonth, visibleDate));
            //------------------------------------------------------------------

            for (int iRow = 0; iRow < 6; iRow++) {
                if (passedLastSupportedDate) {
                    break;
                }

                writer.Write(ROWBEGINTAG);

                // add week selector column and button if required
                if (hasWeekSelectors) {
                    // Range selection. The command starts with an "R". The remainder is an integer. When divided by 100
                    // the result is the day difference from the base date of the first day, and the remainder is the
                    // number of days to select.
                    int dayDiffParameter = (absoluteDay * 100) + 7;

                    // Adjust the dayDiff for the first or the last supported month
                    if (numOfFirstDaysToSkip > 0) {
                        dayDiffParameter -= numOfFirstDaysToSkip;
                    }
                    else if (lastOrSecondLastMonth) {
                        int daysFromLastDate = maxSupportedDate.Subtract(d).Days;
                        if (daysFromLastDate < 6) {
                            dayDiffParameter -= (6 - daysFromLastDate);
                        }
                    }
                    string weekSelectKey = SELECT_RANGE_COMMAND + dayDiffParameter.ToString(CultureInfo.InvariantCulture);

                    string selectWeekTitle = null;
                    if (useAccessibleHeader) {
                        int weekOfMonth = iRow + 1;
                        selectWeekTitle = SR.GetString(SR.Calendar_SelectWeekTitle, weekOfMonth.ToString(CultureInfo.InvariantCulture));
                    }
                    RenderCalendarCell(writer, weekSelectorStyle, selectWeekText, selectWeekTitle, buttonsActive, weekSelectKey);
                }

                for (int iDay = 0; iDay < 7; iDay++) {

                    // Render empty cells for special cases to handle the first
                    // or last supported month.
                    if (numOfFirstDaysToSkip > 0) {
                        iDay += numOfFirstDaysToSkip;
                        for ( ; numOfFirstDaysToSkip > 0; numOfFirstDaysToSkip--) {
                            writer.RenderBeginTag(HtmlTextWriterTag.Td);
                            writer.RenderEndTag();
                        }
                    }
                    else if (passedLastSupportedDate) {
                        for ( ; iDay < 7; iDay++) {
                            writer.RenderBeginTag(HtmlTextWriterTag.Td);
                            writer.RenderEndTag();
                        }
                        break;
                    }

                    int dayOfWeek = (int)threadCalendar.GetDayOfWeek(d);
                    int dayOfMonth = threadCalendar.GetDayOfMonth(d);
                    string dayNumberText;
                    if ((dayOfMonth <= cachedNumberMax) && usesStandardDayDigits) {
                        dayNumberText = cachedNumbers[dayOfMonth];
                    }
                    else {
                        dayNumberText = d.ToString("dd", CultureInfo.CurrentCulture);
                    }

                    CalendarDay day = new CalendarDay(d,
                                                      (dayOfWeek == 0 || dayOfWeek == 6), // IsWeekend
                                                      d.Equals(todaysDate), // IsToday
                                                      (selectedDates != null) && selectedDates.Contains(d), // IsSelected
                                                      threadCalendar.GetMonth(d) != visibleDateMonth, // IsOtherMonth
                                                      dayNumberText // Number Text
                                                      );

                    int styleMask = STYLEMASK_DAY;
                    if (day.IsSelected)
                        styleMask |= STYLEMASK_SELECTED;
                    if (day.IsOtherMonth)
                        styleMask |= STYLEMASK_OTHERMONTH;
                    if (day.IsToday)
                        styleMask |= STYLEMASK_TODAY;
                    if (day.IsWeekend)
                        styleMask |= STYLEMASK_WEEKEND;
                    int dayStyleMask = definedStyleMask  & styleMask;
                    // determine the unique portion of the mask for the current calendar,
                    // which will strip out the day style bit
                    int dayStyleID = dayStyleMask & STYLEMASK_UNIQUE;

                    TableItemStyle cellStyle = cellStyles[dayStyleID];
                    if (cellStyle == null) {
                        cellStyle = new TableItemStyle();
                        SetDayStyles(cellStyle, dayStyleMask, defaultWidth);
                        cellStyles[dayStyleID] = cellStyle;
                    }


                    string dayTitle = null;
                    if (useAccessibleHeader) {
                        dayTitle = d.ToString("m", CultureInfo.CurrentCulture);
                    }

                    if (hasRenderEvent) {

                        TableCell cdc = new TableCell();
                        cdc.ApplyStyle(cellStyle);

                        LiteralControl dayContent = new LiteralControl(dayNumberText);
                        cdc.Controls.Add(dayContent);

                        day.IsSelectable = daysSelectable;

                        OnDayRender(cdc, day);

                        // refresh the day content
                        dayContent.Text = GetCalendarButtonText(absoluteDay.ToString(CultureInfo.InvariantCulture),
                                                                dayNumberText,
                                                                dayTitle,
                                                                buttonsActive && day.IsSelectable,
                                                                cdc.ForeColor);
                        cdc.RenderControl(writer);

                    }
                    else {
                        // VSWhidbey 480155: In design mode we render days as
                        // texts instead of links so CSS class color setting is
                        // supported.  But this differs in runtime rendering
                        // where CSS class color setting is not supported.  To
                        // correctly mimic the forecolor of runtime rendering in
                        // design time, the default color, which is used in
                        // runtime rendering, is explicitly set in this case.
                        if (inDesignSelectionMode && cellStyle.ForeColor.IsEmpty) {
                            cellStyle.ForeColor = defaultForeColor;
                        }

                        RenderCalendarCell(writer, cellStyle, dayNumberText, dayTitle, daysSelectable, absoluteDay.ToString(CultureInfo.InvariantCulture));
                    }

                    Debug.Assert(!passedLastSupportedDate);
                    if (lastOrSecondLastMonth && d.Month == maxSupportedDate.Month && d.Day == maxSupportedDate.Day) {
                        passedLastSupportedDate = true;
                    }
                    else {
                        d = threadCalendar.AddDays(d, 1);
                        absoluteDay++;
                    }
                }
                writer.Write(ROWENDTAG);
            }
        }