public RenderRepeater ( System.Web.UI.HtmlTextWriter w, IRepeatInfoUser user, System.Web.UI.WebControls.Style controlStyle, |
||
w | System.Web.UI.HtmlTextWriter | |
user | IRepeatInfoUser | |
controlStyle | System.Web.UI.WebControls.Style | |
baseControl | ||
return | void |
protected internal override void RenderContents(HtmlTextWriter writer) { if (Items.Count == 0) { return; } RepeatInfo ri = new RepeatInfo(); ri.RepeatColumns = RepeatColumns; ri.RepeatDirection = RepeatDirection; ri.RepeatLayout = RepeatLayout; ri.CaptionAlign = CaptionAlign; ri.Caption = Caption; ri.UseAccessibleHeader = UseAccessibleHeader; /* * // debugging stuff that I prefer to keep for a while * Console.WriteLine ("RepeatColumns {0}", ri.RepeatColumns); * Console.WriteLine ("RepeatDirection {0}", ri.RepeatDirection); * Console.WriteLine ("RepeatLayout {0}", ri.RepeatLayout); * Console.WriteLine ("OuterTableImplied {0}", ExtractTemplateRows); * Console.WriteLine ("IRepeatInfoUser.HasFooter {0}", (ShowFooter && (footerTemplate != null))); * Console.WriteLine ("IRepeatInfoUser.HasHeader {0}", (ShowHeader && (headerTemplate != null))); * Console.WriteLine ("IRepeatInfoUser.HasSeparators {0}", (separatorTemplate != null)); * Console.WriteLine ("IRepeatInfoUser.RepeatedItemCount {0}", Items.Count); * for (int i=0; i < Items.Count; i++) { * DataListItem dli = Items [i]; * Console.WriteLine ("{0}: Index {1}, Type {2}", i, dli.ItemIndex, dli.ItemType); * } */ bool extract = ExtractTemplateRows; if (extract) { ri.OuterTableImplied = true; writer.AddAttribute(HtmlTextWriterAttribute.Id, ClientID); if (ControlStyleCreated) { ControlStyle.AddAttributesToRender(writer); } writer.RenderBeginTag(HtmlTextWriterTag.Table); ri.RenderRepeater(writer, this, ControlStyle, this); writer.RenderEndTag(); } else { ri.RenderRepeater(writer, this, ControlStyle, this); } }
protected internal override void Render(HtmlTextWriter writer) { if (Items.Count == 0) { return; } RepeatInfo ri = new RepeatInfo(); ri.RepeatColumns = RepeatColumns; ri.RepeatDirection = RepeatDirection; ri.RepeatLayout = RepeatLayout; short ti = 0; if (TabIndex != 0) { check_box.TabIndex = TabIndex; ti = TabIndex; TabIndex = 0; } string ak = AccessKey; check_box.AccessKey = ak; this.AccessKey = null; ri.RenderRepeater(writer, this, TableStyle, this); if (ti != 0) { TabIndex = ti; } this.AccessKey = ak; }
/// <include file='doc\RadioButtonList.uex' path='docs/doc[@for="RadioButtonList.Render"]/*' /> /// <internalonly/> /// <devdoc> /// </devdoc> protected override void Render(HtmlTextWriter writer) { RepeatInfo repeatInfo = new RepeatInfo(); Style style = (ControlStyleCreated ? ControlStyle : null); bool undirtyTabIndex = false; // TabIndex here is special... it needs to be applied to the individual // radiobuttons and not the outer control itself // cache away the TabIndex property state radioButtonTabIndex = TabIndex; if (radioButtonTabIndex != 0) { if (ViewState.IsItemDirty("TabIndex") == false) { undirtyTabIndex = true; } TabIndex = 0; } repeatInfo.RepeatColumns = RepeatColumns; repeatInfo.RepeatDirection = RepeatDirection; repeatInfo.RepeatLayout = RepeatLayout; repeatInfo.RenderRepeater(writer, (IRepeatInfoUser)this, style, this); // restore the state of the TabIndex property if (radioButtonTabIndex != 0) { TabIndex = radioButtonTabIndex; } if (undirtyTabIndex) { ViewState.SetItemDirty("TabIndex", false); } }
protected internal override void Render(HtmlTextWriter writer) { Page page = Page; if (page != null) { page.ClientScript.RegisterForEventValidation(UniqueID); } if (Items.Count == 0) { return; } RepeatInfo repeat = new RepeatInfo(); repeat.RepeatColumns = RepeatColumns; repeat.RepeatDirection = RepeatDirection; repeat.RepeatLayout = RepeatLayout; tabIndex = TabIndex; TabIndex = 0; repeat.RenderRepeater(writer, this, ControlStyle, this); TabIndex = tabIndex; }
public static string DoTest (int cols, int cnt, RepeatDirection d, RepeatLayout l, bool OuterTableImplied, bool hdr, bool ftr, bool sep) { HtmlTextWriter htw = GetWriter (); RepeatInfo ri = new RepeatInfo (); ri.RepeatColumns = cols; ri.RepeatDirection = d; ri.RepeatLayout = l; ri.OuterTableImplied = OuterTableImplied; Style s = new Style (); if (cols != 3) s.CssClass = "mainstyle"; ri.RenderRepeater (htw, new RepeatInfoUser (hdr, ftr, sep, cnt), s, new DataList ()); return htw.InnerWriter.ToString (); }
protected internal override void Render(HtmlTextWriter writer) { if ((this.Items.Count != 0) || base.EnableLegacyRendering) { RepeatInfo info = new RepeatInfo(); Style controlStyle = base.ControlStyleCreated ? base.ControlStyle : null; short tabIndex = this.TabIndex; bool flag = false; this.ControlToRepeat.TabIndex = tabIndex; if (tabIndex != 0) { if (!this.ViewState.IsItemDirty("TabIndex")) { flag = true; } this.TabIndex = 0; } info.RepeatColumns = this.RepeatColumns; info.RepeatDirection = this.RepeatDirection; if (!base.DesignMode && !this.Context.Request.Browser.Tables) { info.RepeatLayout = System.Web.UI.WebControls.RepeatLayout.Flow; } else { info.RepeatLayout = this.RepeatLayout; } if (info.RepeatLayout == System.Web.UI.WebControls.RepeatLayout.Flow) { info.EnableLegacyRendering = base.EnableLegacyRendering; } info.RenderRepeater(writer, this, controlStyle, this); if (this.Page != null) { this.Page.ClientScript.RegisterForEventValidation(this.UniqueID); } if (tabIndex != 0) { this.TabIndex = tabIndex; } if (flag) { this.ViewState.SetItemDirty("TabIndex", false); } } }
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); } } }
string DoTest (int cols, int cnt, RepeatDirection d, RepeatLayout l, bool OuterTableImplied, bool ftr, bool hdr, bool sep) { HtmlTextWriter htw = GetWriter (); RepeatInfo ri = new RepeatInfo (); ri.RepeatColumns = cols; ri.RepeatDirection = d; ri.RepeatLayout = l; ri.OuterTableImplied = OuterTableImplied; ri.RenderRepeater (htw, new RepeatInfoUser (ftr, hdr, sep, cnt), new TableStyle (), new DataList ()); return htw.InnerWriter.ToString (); }
private void RenderRepeater_BaseControl (string s, string msg, WebControl wc) { RepeatInfo ri = new RepeatInfo (); ri.RepeatColumns = 3; ri.RepeatDirection = RepeatDirection.Vertical; ri.RepeatLayout = RepeatLayout.Table; HtmlTextWriter writer = GetWriter (); ri.RenderRepeater (writer, new RepeatInfoUser (false, false, false, 1), new TableStyle (), wc); string rendered = writer.InnerWriter.ToString (); Assert.AreEqual (s, rendered, msg); }
protected override void Render(HtmlTextWriter writer) { RepeatInfo info = new RepeatInfo(); Style cStyle = (ControlStyleCreated ? ControlStyle : null); bool dirty = false; tabIndex = TabIndex; if(tabIndex != 0) { dirty = !ViewState.IsItemDirty("TabIndex"); TabIndex = 0; } info.RepeatColumns = RepeatColumns; info.RepeatDirection = RepeatDirection; info.RepeatLayout = RepeatLayout; info.RenderRepeater(writer, this, cStyle, this); if(tabIndex != 0) { TabIndex = tabIndex; } if(dirty) { ViewState.SetItemDirty("TabIndex", false); } }
protected internal override void Render(HtmlTextWriter writer) { // Rendering an empty table is not valid xhtml or html 4, so throw if (RepeatLayout == RepeatLayout.Table && RenderWhenDataEmpty) { throw new InvalidOperationException(SR.GetString(SR.ListControl_RenderWhenDataEmptyNotSupportedWithTableLayout, ID)); } // Don't render anything if the control is empty (unless the developer opts in by setting RenderWhenDataEmpty). // empty table is not xhtml compliant. if (Items.Count == 0 && !EnableLegacyRendering && !RenderWhenDataEmpty) { return; } RepeatInfo repeatInfo = new RepeatInfo(); Style style = (ControlStyleCreated ? ControlStyle : null); short tabIndex = TabIndex; bool undirtyTabIndex = false; // TabIndex here is special... it needs to be applied to the individual // radiobuttons and not the outer control itself // cache away the TabIndex property state ControlToRepeat.TabIndex = tabIndex; if (tabIndex != 0) { if (ViewState.IsItemDirty("TabIndex") == false) { undirtyTabIndex = true; } TabIndex = 0; } repeatInfo.RepeatColumns = RepeatColumns; repeatInfo.RepeatDirection = RepeatDirection; // If the device does not support tables, use the flow layout to render if (!DesignMode && !Context.Request.Browser.Tables) { repeatInfo.RepeatLayout = RepeatLayout.Flow; } else { repeatInfo.RepeatLayout = RepeatLayout; } if (repeatInfo.RepeatLayout == RepeatLayout.Flow) { repeatInfo.EnableLegacyRendering = EnableLegacyRendering; } repeatInfo.RenderRepeater(writer, (IRepeatInfoUser)this, style, this); if (Page != null) { Page.ClientScript.RegisterForEventValidation(UniqueID); } // restore the state of the TabIndex property if (tabIndex != 0) { TabIndex = tabIndex; } if (undirtyTabIndex) { ViewState.SetItemDirty("TabIndex", false); } }
protected internal override void Render (HtmlTextWriter writer) { if (Items.Count == 0) return; RepeatInfo ri = new RepeatInfo (); ri.RepeatColumns = RepeatColumns; ri.RepeatDirection = RepeatDirection; ri.RepeatLayout = RepeatLayout; short ti = 0; if (TabIndex != 0) { check_box.TabIndex = TabIndex; ti = TabIndex; TabIndex = 0; } string ak = AccessKey; check_box.AccessKey = ak; this.AccessKey = null; ri.RenderRepeater (writer, this, TableStyle, this); if (ti != 0) TabIndex = ti; this.AccessKey = ak; }
override void Render (HtmlTextWriter writer) { #if NET_2_0 if (Page != null) Page.ClientScript.RegisterForEventValidation (UniqueID); if (Items.Count == 0) return; #endif RepeatInfo repeat = new RepeatInfo (); repeat.RepeatColumns = RepeatColumns; repeat.RepeatDirection = RepeatDirection; repeat.RepeatLayout = RepeatLayout; tabIndex = TabIndex; TabIndex = 0; repeat.RenderRepeater (writer, this, ControlStyle, this); TabIndex = tabIndex; }
/// <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) { RepeatInfo ri = new RepeatInfo(); checkBoxRepeater.TabIndex = TabIndex; bool dirtyFlag = false; short tTabIndex = TabIndex; Style s = (ControlStyleCreated ? ControlStyle : null); if(TabIndex != 0) { if(!ViewState.IsItemDirty("TabIndex")) dirtyFlag = true; TabIndex = 0; } ri.RepeatColumns = RepeatColumns; ri.RepeatLayout = RepeatLayout; ri.RepeatDirection = RepeatDirection; ri.RenderRepeater(writer, this, s, this); if(tTabIndex != 0) { TabIndex = tTabIndex; } if(dirtyFlag) { ViewState.SetItemDirty("TabIndex", false); } }
protected internal override void Render(HtmlTextWriter writer) { if ((this.Items.Count != 0) || base.EnableLegacyRendering) { RepeatInfo info = new RepeatInfo(); Style controlStyle = base.ControlStyleCreated ? base.ControlStyle : null; short tabIndex = this.TabIndex; bool flag = false; this.ControlToRepeat.TabIndex = tabIndex; if (tabIndex != 0) { if (!this.ViewState.IsItemDirty("TabIndex")) { flag = true; } this.TabIndex = 0; } info.RepeatColumns = this.RepeatColumns; info.RepeatDirection = this.RepeatDirection; if (!base.DesignMode && !this.Context.Request.Browser.Tables) { info.RepeatLayout = System.Web.UI.WebControls.RepeatLayout.Flow; } else { info.RepeatLayout = this.RepeatLayout; } if (info.RepeatLayout == System.Web.UI.WebControls.RepeatLayout.Flow) { info.EnableLegacyRendering = base.EnableLegacyRendering; } info.RenderRepeater(writer, this, controlStyle, this); if (this.Page != null) { this.Page.ClientScript.RegisterForEventValidation(this.UniqueID); } if (tabIndex != 0) { this.TabIndex = tabIndex; } if (flag) { this.ViewState.SetItemDirty("TabIndex", false); } } }
protected internal override void RenderContents (HtmlTextWriter writer) { if (Items.Count == 0) return; RepeatInfo ri = new RepeatInfo (); ri.RepeatColumns = RepeatColumns; ri.RepeatDirection = RepeatDirection; ri.RepeatLayout = RepeatLayout; ri.CaptionAlign = CaptionAlign; ri.Caption = Caption; ri.UseAccessibleHeader = UseAccessibleHeader; /* // debugging stuff that I prefer to keep for a while Console.WriteLine ("RepeatColumns {0}", ri.RepeatColumns); Console.WriteLine ("RepeatDirection {0}", ri.RepeatDirection); Console.WriteLine ("RepeatLayout {0}", ri.RepeatLayout); Console.WriteLine ("OuterTableImplied {0}", ExtractTemplateRows); Console.WriteLine ("IRepeatInfoUser.HasFooter {0}", (ShowFooter && (footerTemplate != null))); Console.WriteLine ("IRepeatInfoUser.HasHeader {0}", (ShowHeader && (headerTemplate != null))); Console.WriteLine ("IRepeatInfoUser.HasSeparators {0}", (separatorTemplate != null)); Console.WriteLine ("IRepeatInfoUser.RepeatedItemCount {0}", Items.Count); for (int i=0; i < Items.Count; i++) { DataListItem dli = Items [i]; Console.WriteLine ("{0}: Index {1}, Type {2}", i, dli.ItemIndex, dli.ItemType); } */ bool extract = ExtractTemplateRows; if (extract) { ri.OuterTableImplied = true; writer.AddAttribute (HtmlTextWriterAttribute.Id, ClientID); if (ControlStyleCreated) ControlStyle.AddAttributesToRender (writer); writer.RenderBeginTag (HtmlTextWriterTag.Table); ri.RenderRepeater (writer, this, ControlStyle, this); writer.RenderEndTag (); } else ri.RenderRepeater (writer, this, ControlStyle, this); }
/// <internalonly/> /// <devdoc> /// <para> /// Displays the <see cref='System.Web.UI.WebControls.CheckBoxList'/> on the client. /// </para> /// </devdoc> protected internal override void Render(HtmlTextWriter writer) { // Rendering an empty table is not valid xhtml or html 4, so throw if (RepeatLayout == RepeatLayout.Table && RenderWhenDataEmpty) { throw new InvalidOperationException(SR.GetString(SR.ListControl_RenderWhenDataEmptyNotSupportedWithTableLayout, ID)); } // Don't render anything if the control is empty (unless the developer opts in by setting RenderWhenDataEmpty). // empty table is not xhtml compliant. if (Items.Count == 0 && !EnableLegacyRendering && !RenderWhenDataEmpty) { return; } RepeatInfo repeatInfo = new RepeatInfo(); Style style = (ControlStyleCreated ? ControlStyle : null); short tabIndex = TabIndex; bool undirtyTabIndex = false; // TabIndex here is special... it needs to be applied to the individual // checkboxes and not the outer control itself // Set the TextAlign property. _controlToRepeat.TextAlign = TextAlign; // cache away the TabIndex property state _controlToRepeat.TabIndex = tabIndex; if (tabIndex != 0) { if (ViewState.IsItemDirty("TabIndex") == false) { undirtyTabIndex = true; } TabIndex = 0; } repeatInfo.RepeatColumns = RepeatColumns; repeatInfo.RepeatDirection = RepeatDirection; // If the device does not support tables, use the flow layout to render if (!DesignMode && !Context.Request.Browser.Tables) { repeatInfo.RepeatLayout = RepeatLayout.Flow; } else { repeatInfo.RepeatLayout = RepeatLayout; } if (repeatInfo.RepeatLayout == RepeatLayout.Flow) { repeatInfo.EnableLegacyRendering = EnableLegacyRendering; } // VSWhidbey 373655 // Temporarily suppress AccessKey so base does not render it on the outside tag _oldAccessKey = AccessKey; AccessKey = String.Empty; repeatInfo.RenderRepeater(writer, (IRepeatInfoUser)this, style, this); // restore the state of AccessKey property AccessKey = _oldAccessKey; // restore the state of the TabIndex property if (tabIndex != 0) { TabIndex = tabIndex; } if (undirtyTabIndex) { ViewState.SetItemDirty("TabIndex", false); } }
protected override void Render(HtmlTextWriter writer) { var repeatInfo = new RepeatInfo(); if (!this.ControlStyleCreated) { var tabIndex = this.TabIndex; var flag = false; if(Convert.ToBoolean(tabIndex)) { if (!this.ViewState.IsItemDirty("TabIndex")) flag = true; this.TabIndex = 0; } repeatInfo.RepeatLayout = RepeatLayout.Flow; // Create dummy htmlTextWriter because repeatInfo generates an unwanted span-tag // So we generate the items in the global private htmlTextWriter. using(var sw = new StringWriter(CultureInfo.InvariantCulture)) { using(var repWriter = new HtmlTextWriter(sw)) { repeatInfo.RenderRepeater(repWriter, this, null, this); } } writer.Write(this.StringWriter); // Copy the private htmlTextWriter into the current htmlTextWriter. if (Convert.ToBoolean(tabIndex)) this.TabIndex = tabIndex; if (Convert.ToBoolean(flag)) this.ViewState.SetItemDirty("TabIndex", false); } }
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 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); } } }