protected internal override void RenderContents(HtmlTextWriter writer) { if (this.Controls.Count != 0) { RepeatInfo info = new RepeatInfo(); Table table = null; Style controlStyle = base.ControlStyle; if (this.extractTemplateRows) { info.RepeatDirection = System.Web.UI.WebControls.RepeatDirection.Vertical; info.RepeatLayout = System.Web.UI.WebControls.RepeatLayout.Flow; info.RepeatColumns = 1; info.OuterTableImplied = true; table = new Table { ID = this.ClientID }; table.CopyBaseAttributes(this); table.Caption = this.Caption; table.CaptionAlign = this.CaptionAlign; table.ApplyStyle(controlStyle); table.RenderBeginTag(writer); } else { info.RepeatDirection = this.RepeatDirection; info.RepeatLayout = this.RepeatLayout; info.RepeatColumns = this.RepeatColumns; if (info.RepeatLayout == System.Web.UI.WebControls.RepeatLayout.Table) { info.Caption = this.Caption; info.CaptionAlign = this.CaptionAlign; info.UseAccessibleHeader = this.UseAccessibleHeader; } else { info.EnableLegacyRendering = base.EnableLegacyRendering; } } info.RenderRepeater(writer, this, controlStyle, this); if (table != null) { table.RenderEndTag(writer); } } }
protected override void RenderContents (HtmlTextWriter writer) { if (Controls.Count == 0) return; RepeatInfo repeater = new RepeatInfo (); Table templateTable = null; if (extractTemplateRows) { repeater.RepeatDirection = RepeatDirection.Vertical; repeater.RepeatLayout = RepeatLayout.Flow; repeater.RepeatColumns = 1; repeater.OuterTableImplied = true; templateTable = new Table (); templateTable.ID = ClientID; templateTable.CopyBaseAttributes (this); templateTable.ApplyStyle (ControlStyle); templateTable.RenderBeginTag (writer); } else { repeater.RepeatDirection = RepeatDirection; repeater.RepeatLayout = RepeatLayout; repeater.RepeatColumns = RepeatColumns; } repeater.RenderRepeater (writer, this, ControlStyle, this); if (templateTable != null) { templateTable.RenderEndTag (writer); } }
protected internal override void Render(HtmlTextWriter writer) { bool isEnabled; this.threadCalendar = DateTimeFormatInfo.CurrentInfo.Calendar; this.minSupportedDate = this.threadCalendar.MinSupportedDateTime; this.maxSupportedDate = this.threadCalendar.MaxSupportedDateTime; DateTime visibleDate = this.EffectiveVisibleDate(); DateTime firstDay = this.FirstCalendarDay(visibleDate); CalendarSelectionMode selectionMode = this.SelectionMode; if (this.Page != null) { this.Page.VerifyRenderingInServerForm(this); } if ((this.Page == null) || base.DesignMode) { isEnabled = false; } else { isEnabled = base.IsEnabled; } this.defaultForeColor = this.ForeColor; if (this.defaultForeColor == Color.Empty) { this.defaultForeColor = DefaultForeColor; } this.defaultButtonColorText = ColorTranslator.ToHtml(this.defaultForeColor); Table table = new Table(); if (this.ID != null) { table.ID = this.ClientID; } table.CopyBaseAttributes(this); if (base.ControlStyleCreated) { table.ApplyStyle(base.ControlStyle); } table.Width = this.Width; table.Height = this.Height; table.CellPadding = this.CellPadding; table.CellSpacing = this.CellSpacing; if ((!base.ControlStyleCreated || !base.ControlStyle.IsSet(0x20)) || this.BorderWidth.Equals(Unit.Empty)) { table.BorderWidth = Unit.Pixel(1); } if (this.ShowGridLines) { table.GridLines = GridLines.Both; } else { table.GridLines = GridLines.None; } bool useAccessibleHeader = this.UseAccessibleHeader; if (useAccessibleHeader && (table.Attributes["title"] == null)) { table.Attributes["title"] = System.Web.SR.GetString("Calendar_TitleText"); } string caption = this.Caption; if (caption.Length > 0) { table.Caption = caption; table.CaptionAlign = this.CaptionAlign; } table.RenderBeginTag(writer); if (this.ShowTitle) { this.RenderTitle(writer, visibleDate, selectionMode, isEnabled, useAccessibleHeader); } if (this.ShowDayHeader) { this.RenderDayHeader(writer, visibleDate, selectionMode, isEnabled, useAccessibleHeader); } this.RenderDays(writer, firstDay, visibleDate, selectionMode, isEnabled, useAccessibleHeader); table.RenderEndTag(writer); }
/// <internalonly/> /// <devdoc> /// </devdoc> protected internal override void RenderContents(HtmlTextWriter writer) { if (Controls.Count == 0) return; RepeatInfo repeatInfo = new RepeatInfo(); Table outerTable = null; // NOTE: This will end up creating the ControlStyle... Ideally we would // not create the style just for rendering, but turns out our default // style isn't empty, and does have an effect on rendering, and must // therefore always be created Style style = ControlStyle; if (extractTemplateRows) { // The table tags in the templates are stripped out and only the // <tr>'s and <td>'s are assumed to come from the template itself. // This is equivalent to a flow layout of <tr>'s in a single // vertical column. repeatInfo.RepeatDirection = RepeatDirection.Vertical; repeatInfo.RepeatLayout = RepeatLayout.Flow; repeatInfo.RepeatColumns = 1; repeatInfo.OuterTableImplied = true; outerTable = new Table(); // use ClientID (and not ID) since we want to render the fully qualified // ID even though the control will not be parented to the control hierarchy outerTable.ID = ClientID; outerTable.CopyBaseAttributes(this); outerTable.Caption = Caption; outerTable.CaptionAlign = CaptionAlign; outerTable.ApplyStyle(style); outerTable.RenderBeginTag(writer); } else { repeatInfo.RepeatDirection = RepeatDirection; repeatInfo.RepeatLayout = RepeatLayout; repeatInfo.RepeatColumns = RepeatColumns; if (repeatInfo.RepeatLayout == RepeatLayout.Table) { repeatInfo.Caption = Caption; repeatInfo.CaptionAlign = CaptionAlign; repeatInfo.UseAccessibleHeader = UseAccessibleHeader; } else { repeatInfo.EnableLegacyRendering = EnableLegacyRendering; } } repeatInfo.RenderRepeater(writer, (IRepeatInfoUser)this, style, this); if (outerTable != null) outerTable.RenderEndTag(writer); }
protected override void Render(HtmlTextWriter writer) { globCal = DateTimeFormatInfo.CurrentInfo.Calendar; DateTime visDate = GetEffectiveVisibleDate(); DateTime firstDate = GetFirstCalendarDay(visDate); bool isEnabled; bool isHtmlTextWriter; //FIXME: when Control.Site works, reactivate this //if (Page == null || Site == null) { // isEnabled = false; // isHtmlTextWriter = false; //} else { isEnabled = Enabled; isHtmlTextWriter = (writer.GetType() != typeof(HtmlTextWriter)); //} defaultTextColor = ForeColor; if(defaultTextColor == Color.Empty) defaultTextColor = Color.Black; Table calTable = new Table (); calTable.ID = ID; calTable.CopyBaseAttributes(this); if(ControlStyleCreated) calTable.ApplyStyle(ControlStyle); calTable.Width = Width; calTable.Height = Height; calTable.CellSpacing = CellSpacing; calTable.CellPadding = CellPadding; if (ControlStyleCreated && ControlStyle.IsSet (WebControls.Style.BORDERWIDTH) && BorderWidth != Unit.Empty) calTable.BorderWidth = BorderWidth; else calTable.BorderWidth = Unit.Pixel(1); if (ShowGridLines) calTable.GridLines = GridLines.Both; else calTable.GridLines = GridLines.None; #if NET_2_0 calTable.Caption = Caption; calTable.CaptionAlign = CaptionAlign; #endif calTable.RenderBeginTag (writer); if (ShowTitle) RenderTitle (writer, visDate, SelectionMode, isEnabled); if (ShowDayHeader) RenderHeader (writer, firstDate, SelectionMode, isEnabled, isHtmlTextWriter); RenderAllDays (writer, firstDate, visDate, SelectionMode, isEnabled, isHtmlTextWriter); calTable.RenderEndTag(writer); }
/********************************************************************************* * * Calendar rendering methods * *********************************************************************************/ //Creates the table for the calendar private Table CreateTable(DateTime visibleDate, DateTime firstDay, System.Globalization.Calendar threadCalendar) { Color defaultColor = ForeColor; if (defaultColor == Color.Empty) { defaultColor = Color.Black; } defaultButtonColorText = ColorTranslator.ToHtml(defaultColor); Table table = new Table(); if (ID != null) { table.ID = ClientID; } table.CopyBaseAttributes(this); if (ControlStyleCreated) { table.ApplyStyle(ControlStyle); } table.Width = Width; table.Height = Height; table.CellPadding = CellPadding; table.CellSpacing = CellSpacing; // default look if ((ControlStyleCreated == false) || BorderWidth.Equals(Unit.Empty)) { table.BorderWidth = Unit.Pixel(1); } if (ShowGridLines) { table.GridLines = GridLines.Both; } else { table.GridLines = GridLines.None; } bool useAccessibleHeader = UseAccessibleHeader; if (useAccessibleHeader) { if (table.Attributes["title"] == null) { table.Attributes["title"] = string.Empty; } } string caption = Caption; if (caption.Length > 0) { table.Caption = caption; table.CaptionAlign = CaptionAlign; } if (ShowTitle) { table.Rows.Add(CreateTitleRow(visibleDate, threadCalendar)); } if (ShowDayHeader) { table.Rows.Add(CreateDayHeader(firstDay, visibleDate, threadCalendar)); } return table; }
/// <internalonly/> /// <devdoc> /// <para>Displays the <see cref='System.Web.UI.WebControls.Calendar'/> control on the client.</para> /// </devdoc> protected internal override void Render(HtmlTextWriter writer) { threadCalendar = DateTimeFormatInfo.CurrentInfo.Calendar; minSupportedDate = threadCalendar.MinSupportedDateTime; maxSupportedDate = threadCalendar.MaxSupportedDateTime; #if DEBUG threadCalendarInitialized = true; #endif DateTime visibleDate = EffectiveVisibleDate(); DateTime firstDay = FirstCalendarDay(visibleDate); CalendarSelectionMode selectionMode = SelectionMode; // Make sure we are in a form tag with runat=server. if (Page != null) { Page.VerifyRenderingInServerForm(this); } // We only want to display the link if we have a page, or if we are on the design surface // If we can stops links being active on the Autoformat dialog, then we can remove this these checks. Page page = Page; bool buttonsActive; if (page == null || DesignMode) { buttonsActive = false; } else { buttonsActive = IsEnabled; } defaultForeColor = ForeColor; if (defaultForeColor == Color.Empty) { defaultForeColor = DefaultForeColor; } defaultButtonColorText = ColorTranslator.ToHtml(defaultForeColor); Table table = new Table(); if (ID != null) { table.ID = ClientID; } table.CopyBaseAttributes(this); if (ControlStyleCreated) { table.ApplyStyle(ControlStyle); } table.Width = Width; table.Height = Height; table.CellPadding = CellPadding; table.CellSpacing = CellSpacing; // default look if ((ControlStyleCreated == false) || (ControlStyle.IsSet(System.Web.UI.WebControls.Style.PROP_BORDERWIDTH) == false) || BorderWidth.Equals(Unit.Empty)) { table.BorderWidth = Unit.Pixel(1); } if (ShowGridLines) { table.GridLines = GridLines.Both; } else { table.GridLines = GridLines.None; } bool useAccessibleHeader = UseAccessibleHeader; if (useAccessibleHeader) { if (table.Attributes["title"] == null) { table.Attributes["title"] = SR.GetString(SR.Calendar_TitleText); } } string caption = Caption; if (caption.Length > 0) { table.Caption = caption; table.CaptionAlign = CaptionAlign; } table.RenderBeginTag(writer); if (ShowTitle) { RenderTitle(writer, visibleDate, selectionMode, buttonsActive, useAccessibleHeader); } if (ShowDayHeader) { RenderDayHeader(writer, visibleDate, selectionMode, buttonsActive, useAccessibleHeader); } RenderDays(writer, firstDay, visibleDate, selectionMode, buttonsActive, useAccessibleHeader); table.RenderEndTag(writer); }