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;
        }
Beispiel #2
0
        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;
        }
Beispiel #3
0
        protected virtual void RenderItem(ListItemType itemType, int repeatIndex, RepeatInfo repeatInfo, HtmlTextWriter writer)
        {
            ListItem item = Items [repeatIndex];

            RadioButton radio = new RadioButton();

            radio.Text             = item.Text;
            radio.ID               = ClientID + "_" + repeatIndex;
            radio.TextAlign        = TextAlign;
            radio.GroupName        = UniqueID;
            radio.Page             = Page;
            radio.Checked          = item.Selected;
            radio.ValueAttribute   = item.Value;
            radio.AutoPostBack     = AutoPostBack;
            radio.Enabled          = IsEnabled;
            radio.TabIndex         = tabIndex;
            radio.ValidationGroup  = ValidationGroup;
            radio.CausesValidation = CausesValidation;
            if (radio.HasAttributes)
            {
                radio.Attributes.Clear();
            }
            if (item.HasAttributes)
            {
                radio.Attributes.CopyFrom(item.Attributes);
            }

            radio.RenderControl(writer);
        }
Beispiel #4
0
        /// <include file='doc\RadioButtonList.uex' path='docs/doc[@for="RadioButtonList.IRepeatInfoUser.RenderItem"]/*' />
        /// <internalonly/>
        /// <devdoc>
        /// Called by the RepeatInfo helper to render each item
        /// </devdoc>
        void IRepeatInfoUser.RenderItem(ListItemType itemType, int repeatIndex, RepeatInfo repeatInfo, HtmlTextWriter writer)
        {
            RadioButton controlToRepeat;

            controlToRepeat       = new RadioButton();
            controlToRepeat._page = Page;

            // This will cause the postback to go back to this control
            controlToRepeat.GroupName = UniqueID;
            controlToRepeat.ID        = ClientID + "_" + repeatIndex.ToString(NumberFormatInfo.InvariantInfo);

            // Apply properties of the list items
            controlToRepeat.Text = Items[repeatIndex].Text;
            controlToRepeat.Attributes["value"] = Items[repeatIndex].Value;
            controlToRepeat.Checked             = Items[repeatIndex].Selected;

            // Apply other properties
            // CONSIDER: apply RadioButtonList style to RadioButtons?
            controlToRepeat.TextAlign    = TextAlign;
            controlToRepeat.AutoPostBack = this.AutoPostBack;
            controlToRepeat.TabIndex     = radioButtonTabIndex;
            controlToRepeat.Enabled      = this.Enabled;

            controlToRepeat.RenderControl(writer);
        }
Beispiel #5
0
        protected virtual void RenderItem(ListItemType itemType, int repeatIndex, RepeatInfo repeatInfo, HtmlTextWriter writer)
        {
            if (repeatIndex == 0)
            {
                this._cachedIsEnabled       = base.IsEnabled;
                this._cachedRegisterEnabled = (this.Page != null) && !base.SaveSelectedIndicesViewState;
            }
            RadioButton controlToRepeat = this.ControlToRepeat;
            int         index           = repeatIndex + this._offset;
            ListItem    item            = this.Items[index];

            controlToRepeat.Attributes.Clear();
            if (item.HasAttributes)
            {
                foreach (string str in item.Attributes.Keys)
                {
                    controlToRepeat.Attributes[str] = item.Attributes[str];
                }
            }
            if (!string.IsNullOrEmpty(controlToRepeat.CssClass))
            {
                controlToRepeat.CssClass = "";
            }
            ListControl.SetControlToRepeatID(this, controlToRepeat, index);
            controlToRepeat.Text = item.Text;
            controlToRepeat.Attributes["value"] = item.Value;
            controlToRepeat.Checked             = item.Selected;
            controlToRepeat.Enabled             = this._cachedIsEnabled && item.Enabled;
            controlToRepeat.TextAlign           = this.TextAlign;
            controlToRepeat.RenderControl(writer);
            if ((controlToRepeat.Enabled && this._cachedRegisterEnabled) && (this.Page != null))
            {
                this.Page.RegisterEnabledControl(controlToRepeat);
            }
        }
Beispiel #6
0
        /// <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);
            }
        }
Beispiel #7
0
        void RenderItem(ListItemType itemType,
                        int repeatIndex,
                        RepeatInfo repeatInfo,
                        HtmlTextWriter writer)
        {
            ListItem item = Items [repeatIndex];

            check_box.ID           = repeatIndex.ToString(Helpers.InvariantCulture);
            check_box.Text         = item.Text;
            check_box.AutoPostBack = AutoPostBack;
            check_box.Checked      = item.Selected;
            check_box.TextAlign    = TextAlign;
            check_box.Enabled      = Enabled;
#if NET_2_0
            check_box.ValidationGroup  = ValidationGroup;
            check_box.CausesValidation = CausesValidation;
            if (check_box.HasAttributes)
            {
                check_box.Attributes.Clear();
            }
            if (item.HasAttributes)
            {
                check_box.Attributes.CopyFrom(item.Attributes);
            }
#endif
            check_box.RenderControl(writer);
        }
Beispiel #8
0
 protected override void RenderItem(ListItemType itemType, int repeatIndex, RepeatInfo repeatInfo, HtmlTextWriter writer)
 {
     ListItem listItem = this.Items[repeatIndex];
     if (_UnderlyingCheckbox != null) {
         _UnderlyingCheckbox.InputAttributes["value"] = listItem.Value;
     }
     base.RenderItem(itemType, repeatIndex, repeatInfo, writer);
 }
        void IRepeatInfoUser.RenderItem(ListItemType itemType, int repeatIndex, RepeatInfo repeatInfo, HtmlTextWriter writer)
        {
            DataListItem item = this.GetItem(itemType, repeatIndex + this.offset);

            if (item != null)
            {
                item.RenderItem(writer, this.extractTemplateRows, repeatInfo.RepeatLayout == System.Web.UI.WebControls.RepeatLayout.Table);
            }
        }
        /// <include file='doc\CheckBoxList.uex' path='docs/doc[@for="CheckBoxList.IRepeatInfoUser.RenderItem"]/*' />
        /// <internalonly/>
        /// <devdoc>
        /// Called by the RepeatInfo helper to render each item
        /// </devdoc>
        void IRepeatInfoUser.RenderItem(ListItemType itemType, int repeatIndex, RepeatInfo repeatInfo, HtmlTextWriter writer)
        {
            controlToRepeat.ID        = repeatIndex.ToString(NumberFormatInfo.InvariantInfo);
            controlToRepeat.Text      = Items[repeatIndex].Text;
            controlToRepeat.TextAlign = TextAlign;
            controlToRepeat.Checked   = Items[repeatIndex].Selected;
            controlToRepeat.Enabled   = this.Enabled;

            // CONSIDER: apply CheckBoxList style to RadioButtons?
            controlToRepeat.RenderControl(writer);
        }
Beispiel #11
0
        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);
            }
        }
Beispiel #12
0
        void IRepeatInfoUser.RenderItem(ListItemType itemType, int repeatIndex, RepeatInfo repeatInfo, HtmlTextWriter writer)
        {
            // if possible take the easy way out...
            if (!HasControls())
            {
                return;
            }

            DataListItem item = null;

            switch (itemType)
            {
            case ListItemType.Header:
            case ListItemType.Footer:
                item = FindFirstItem(itemType);
                break;

            case ListItemType.Item:
            case ListItemType.AlternatingItem:
            case ListItemType.SelectedItem:
            case ListItemType.EditItem:
                item = FindBestItem(repeatIndex);
                break;

            case ListItemType.Separator:
                item = FindSpecificItem(itemType, repeatIndex);
                break;
            }

            if (item != null)
            {
                bool extract = ExtractTemplateRows;
                bool table   = (RepeatLayout == RepeatLayout.Table);
                if (!table || extract)
                {
                    // sadly RepeatInfo doesn't support Style for RepeatLayout.Flow
                    Style s = (this as IRepeatInfoUser).GetItemStyle(itemType, repeatIndex);
                    if (s != null)
                    {
                        item.ControlStyle.CopyFrom(s);
                    }
                }
//Console.WriteLine ("RenderItem #{0} type {1}", repeatIndex, itemType);
                item.RenderItem(writer, extract, table);
            }
            else
            {
//Console.WriteLine ("Couldn't find #{0} type {1} out of {2} items / {3} controls", repeatIndex, itemType, Items.Count, Controls.Count);
            }
        }
		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 ();
		}
Beispiel #14
0
        /// <internalonly/>
        /// <devdoc>
        /// Called by the RepeatInfo helper to render each item
        /// </devdoc>
        protected virtual void RenderItem(ListItemType itemType, int repeatIndex, RepeatInfo repeatInfo, HtmlTextWriter writer)
        {
            if (repeatIndex == 0)
            {
                _cachedIsEnabled       = IsEnabled;
                _cachedRegisterEnabled = (Page != null) && (SaveSelectedIndicesViewState == false);
            }

            RadioButton controlToRepeat = ControlToRepeat;

            // Apply properties of the list items
            int repeatIndexOffset = repeatIndex + _offset;

            ListItem item = Items[repeatIndexOffset];

            // VSWhidbey 153920 Render expando attributes.
            controlToRepeat.Attributes.Clear();
            if (item.HasAttributes)
            {
                foreach (string key in item.Attributes.Keys)
                {
                    controlToRepeat.Attributes[key] = item.Attributes[key];
                }
            }

            // Dev10 684108: reset the CssClass for each item.
            if (!string.IsNullOrEmpty(controlToRepeat.CssClass))
            {
                controlToRepeat.CssClass = "";
            }

            SetControlToRepeatID(this, controlToRepeat, repeatIndexOffset);
            controlToRepeat.Text = item.Text;

            controlToRepeat.Attributes["value"] = item.Value;
            controlToRepeat.Checked             = item.Selected;
            controlToRepeat.Enabled             = _cachedIsEnabled && item.Enabled;
            controlToRepeat.TextAlign           = TextAlign;
            controlToRepeat.RenderControl(writer);

            if (controlToRepeat.Enabled && _cachedRegisterEnabled && Page != null)
            {
                // Store a client-side array of enabled control, so we can re-enable them on
                // postback (in case they are disabled client-side)
                // Postback is needed when SelectedIndices is not saved in view state
                Page.RegisterEnabledControl(controlToRepeat);
            }
        }
        /// <internalonly/>
        /// <devdoc>
        /// Called by the RepeatInfo helper to render each item
        /// </devdoc>
        protected virtual void RenderItem(ListItemType itemType, int repeatIndex, RepeatInfo repeatInfo, HtmlTextWriter writer)
        {
            if (repeatIndex == 0)
            {
                _cachedIsEnabled       = IsEnabled;
                _cachedRegisterEnabled = (Page != null) && IsEnabled && (SaveSelectedIndicesViewState == false);
            }

            int repeatIndexOffset = repeatIndex;

            ListItem item = Items[repeatIndexOffset];

            // VSWhidbey 403433 Render expando attributes.
            _controlToRepeat.Attributes.Clear();
            if (item.HasAttributes)
            {
                foreach (string key in item.Attributes.Keys)
                {
                    _controlToRepeat.Attributes[key] = item.Attributes[key];
                }
            }

            // Dev10 684108: reset the CssClass for each item.
            if (!string.IsNullOrEmpty(_controlToRepeat.CssClass))
            {
                _controlToRepeat.CssClass = "";
            }

            if (RenderingCompatibility >= VersionUtil.Framework40)
            {
                _controlToRepeat.InputAttributes.Add("value", item.Value);
            }
            SetControlToRepeatID(this, _controlToRepeat, repeatIndexOffset);
            _controlToRepeat.Text      = item.Text;
            _controlToRepeat.Checked   = item.Selected;
            _controlToRepeat.Enabled   = _cachedIsEnabled && item.Enabled;
            _controlToRepeat.AccessKey = _oldAccessKey;

            if (_cachedRegisterEnabled && _controlToRepeat.Enabled)
            {
                // Store a client-side array of enabled control, so we can re-enable them on
                // postback (in case they are disabled client-side)
                // Postback is needed when SelectedIndices is not saved in view state
                Page.RegisterEnabledControl(_controlToRepeat);
            }

            _controlToRepeat.RenderControl(writer);
        }
Beispiel #16
0
 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 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);
         }
     }
 }
Beispiel #19
0
        protected virtual void RenderItem(ListItemType itemType, int repeatIndex, RepeatInfo repeatInfo, HtmlTextWriter writer)
        {
            ListItem item = Items [repeatIndex];

            string cssClass = check_box.CssClass;

            if (!String.IsNullOrEmpty(cssClass))
            {
                check_box.CssClass = String.Empty;
            }
            check_box.ID           = repeatIndex.ToString(Helpers.InvariantCulture);
            check_box.Text         = item.Text;
            check_box.AutoPostBack = AutoPostBack;
            check_box.Checked      = item.Selected;
            check_box.TextAlign    = TextAlign;
            if (!IsEnabled)
            {
                check_box.Enabled = false;
            }
            else
            {
                check_box.Enabled = item.Enabled;
            }

            check_box.ValidationGroup  = ValidationGroup;
            check_box.CausesValidation = CausesValidation;
            if (check_box.HasAttributes)
            {
                check_box.Attributes.Clear();
            }
            if (item.HasAttributes)
            {
                check_box.Attributes.CopyFrom(item.Attributes);
            }
#if NET_4_0
            if (!RenderingCompatibilityLessThan40)
            {
                var attrs = check_box.InputAttributes;

                attrs.Clear();
                attrs.Add("value", item.Value);
            }
#endif
            check_box.RenderControl(writer);
        }
 protected override void RenderItem(ListItemType itemType, int repeatIndex, RepeatInfo repeatInfo,
     HtmlTextWriter writer)
 {
     if (Items[repeatIndex].Value.Equals("%subheader%"))
     {
         writer.Write("<h3 class=\'shipsrvc\'>{0}</h3>", Items[repeatIndex].Text);
     }
     else
     {
         if (Items[repeatIndex].Value.Equals("%msg%"))
         {
             writer.Write("<h4 class=\'shipsrvcmsg\'>{0}</h4>", Items[repeatIndex].Text);
         }
         else
         {
             base.RenderItem(itemType, repeatIndex, repeatInfo, writer);
         }
     }
 }
        protected virtual void RenderItem(ListItemType itemType, int repeatIndex, RepeatInfo repeatInfo, HtmlTextWriter writer)
        {
            if (repeatIndex == 0)
            {
                this._cachedIsEnabled       = base.IsEnabled;
                this._cachedRegisterEnabled = ((this.Page != null) && base.IsEnabled) && !base.SaveSelectedIndicesViewState;
            }
            int      index = repeatIndex;
            ListItem item  = this.Items[index];

            this._controlToRepeat.Attributes.Clear();
            if (item.HasAttributes)
            {
                foreach (string str in item.Attributes.Keys)
                {
                    this._controlToRepeat.Attributes[str] = item.Attributes[str];
                }
            }
            if (!string.IsNullOrEmpty(this._controlToRepeat.CssClass))
            {
                this._controlToRepeat.CssClass = "";
            }
            if (this.RenderingCompatibility >= VersionUtil.Framework40)
            {
                this._controlToRepeat.InputAttributes.Add("value", item.Value);
            }
            ListControl.SetControlToRepeatID(this, this._controlToRepeat, index);
            this._controlToRepeat.Text      = item.Text;
            this._controlToRepeat.Checked   = item.Selected;
            this._controlToRepeat.Enabled   = this._cachedIsEnabled && item.Enabled;
            this._controlToRepeat.AccessKey = this._oldAccessKey;
            if (this._cachedRegisterEnabled && this._controlToRepeat.Enabled)
            {
                this.Page.RegisterEnabledControl(this._controlToRepeat);
            }
            this._controlToRepeat.RenderControl(writer);
        }
Beispiel #22
0
		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);
		}
		public void RenderItem (ListItemType itemType, int repeatIndex, RepeatInfo repeatInfo, HtmlTextWriter writer)
		{
			writer.Write ("({0},{1},{2})", counter++, itemType, repeatIndex);
		}
 void System.Web.UI.WebControls.IRepeatInfoUser.RenderItem(ListItemType itemType, int repeatIndex, RepeatInfo repeatInfo, System.Web.UI.HtmlTextWriter writer)
 {
 }
        /// <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);
            }
        }
		void IRepeatInfoUser.RenderItem (ListItemType itemType,
						 int repeatIndex,
						 RepeatInfo repeatInfo,
						 HtmlTextWriter writer)
		{
			DataListItem item = GetItem (itemType, repeatIndex);
			if (item != null)
				item.RenderItem (writer,
						 extractTemplateRows,
						 (repeatInfo.RepeatLayout == RepeatLayout.Table));
		}
Beispiel #27
0
        /// <summary>
        /// Adds the <strong>onclick</strong> attribute to each item to invoke a callback from the client,
        /// then renders the item.
        /// </summary>
        protected override void RenderItem(ASP.ListItemType itemType, int repeatIndex, ASP.RepeatInfo repeatInfo, HtmlTextWriter writer)
        {
            if (AutoCallBack)
            {
                ASP.ListItem item = this.Items[repeatIndex];
                if (item.Selected)
                {
                    item.Attributes.Remove("onclick");
                }
                else
                {
                    item.Attributes["onclick"] = Anthem.Manager.GetCallbackEventReference(
                        this,
                        repeatIndex.ToString(),
                        this.CausesValidation,
                        this.ValidationGroup
                        );
                }
            }

            base.RenderItem(itemType, repeatIndex, repeatInfo, writer);
        }
Beispiel #28
0
		void IRepeatInfoUser.RenderItem (ListItemType itemType, int repeatIndex, RepeatInfo repeatInfo, HtmlTextWriter writer)
		{
			// if possible take the easy way out...
			if (!HasControls ())
				return;

			DataListItem item = null;
			switch (itemType) {
				case ListItemType.Header:
				case ListItemType.Footer:
					item = FindFirstItem (itemType);
					break;
				case ListItemType.Item:
				case ListItemType.AlternatingItem:
				case ListItemType.SelectedItem:
				case ListItemType.EditItem:
					item = FindBestItem (repeatIndex);
					break;
				case ListItemType.Separator:
					item = FindSpecificItem (itemType, repeatIndex);
					break;
			}

			if (item != null) {
				bool extract = ExtractTemplateRows;
				bool table = (RepeatLayout == RepeatLayout.Table);
				if (!table || extract) {
					// sadly RepeatInfo doesn't support Style for RepeatLayout.Flow
					Style s = (this as IRepeatInfoUser).GetItemStyle (itemType, repeatIndex);
					if (s != null)
						item.ControlStyle.CopyFrom (s);
				}
//Console.WriteLine ("RenderItem #{0} type {1}", repeatIndex, itemType);
				item.RenderItem (writer, extract, table);
			} else {
//Console.WriteLine ("Couldn't find #{0} type {1} out of {2} items / {3} controls", repeatIndex, itemType, Items.Count, Controls.Count);
			}
		}
Beispiel #29
0
		public void RenderItem (ListItemType itemType, int repeatIndex, RepeatInfo repeatInfo, HtmlTextWriter writer)
		{
			writer.Write ((counter++).ToString ());
		}
		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);
			}
		}
		void IRepeatInfoUser.RenderItem (System.Web.UI.WebControls.ListItemType itemType, int repeatIndex, RepeatInfo repeatInfo, HtmlTextWriter writer)
		{
			RenderItem (itemType, repeatIndex, repeatInfo, writer);
		}
		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);
            }
        }
        /// <internalonly/>
        /// <devdoc>
        /// Called by the RepeatInfo helper to render each item
        /// </devdoc>
        protected virtual void RenderItem(ListItemType itemType, int repeatIndex, RepeatInfo repeatInfo, HtmlTextWriter writer) {
            if (repeatIndex == 0) {
                _cachedIsEnabled = IsEnabled;
                _cachedRegisterEnabled = (Page != null) && (SaveSelectedIndicesViewState == false);
            }

            RadioButton controlToRepeat = ControlToRepeat;

            // Apply properties of the list items
            int repeatIndexOffset = repeatIndex + _offset;

            ListItem item = Items[repeatIndexOffset];

            // VSWhidbey 153920 Render expando attributes.
            controlToRepeat.Attributes.Clear();
            if (item.HasAttributes) {
                foreach (string key in item.Attributes.Keys) {
                    controlToRepeat.Attributes[key] = item.Attributes[key];
                }
            }

            // Dev10 684108: reset the CssClass for each item.
            if (!string.IsNullOrEmpty(controlToRepeat.CssClass)) {
                controlToRepeat.CssClass = "";
            }

            SetControlToRepeatID(this, controlToRepeat, repeatIndexOffset);
            controlToRepeat.Text = item.Text;

            controlToRepeat.Attributes["value"] = item.Value;
            controlToRepeat.Checked = item.Selected;
            controlToRepeat.Enabled = _cachedIsEnabled && item.Enabled;
            controlToRepeat.TextAlign = TextAlign;
            controlToRepeat.RenderControl(writer);

            if (controlToRepeat.Enabled && _cachedRegisterEnabled && Page != null) {
                // Store a client-side array of enabled control, so we can re-enable them on
                // postback (in case they are disabled client-side)
                // Postback is needed when SelectedIndices is not saved in view state
                Page.RegisterEnabledControl(controlToRepeat);
            }
        }
 /// <internalonly/>
 /// <devdoc>
 /// Called by the RepeatInfo helper to render each item
 /// </devdoc>
 void IRepeatInfoUser.RenderItem(ListItemType itemType, int repeatIndex, RepeatInfo repeatInfo, HtmlTextWriter writer) {
     RenderItem(itemType, repeatIndex, repeatInfo, writer);
 }
Beispiel #36
0
		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 ();
		}
		void IRepeatInfoUser.RenderItem (System.Web.UI.WebControls.ListItemType itemType, int repeatIndex, RepeatInfo repeatInfo, HtmlTextWriter writer)
#endif
		{
			/* Create a new RadioButton as if it was defined in the page and render it */
			RadioButton button = new RadioButton ();
			button.Page = Page;
			button.GroupName = UniqueID;
			button.TextAlign = TextAlign;
			button.AutoPostBack = AutoPostBack;
			button.ID = ClientID + "_" + repeatIndex.ToString (NumberFormatInfo.InvariantInfo);;
			button.TabIndex = tabIndex;
			ListItem current = Items [repeatIndex];
			button.Text = current.Text;
			button.Attributes ["value"] = current.Value;
			button.Checked = current.Selected;
			button.Enabled = Enabled;
			button.RenderControl (writer);
		}
Beispiel #38
0
		public void RepeatInfoRenderItem ()
		{
			StringWriter sw = new StringWriter ();
			HtmlTextWriter tw = new HtmlTextWriter (sw);
			CheckBoxList c = new CheckBoxList ();
			IRepeatInfoUser ri = (IRepeatInfoUser) c;
			RepeatInfo r = new RepeatInfo ();

			c.Items.Add ("one");
			c.Items.Add ("two");

			ri.RenderItem (ListItemType.Item, 0, r, tw); 
			Assert.AreEqual ("<input id=\"0\" type=\"checkbox\" name=\"0\" />" +
					"<label for=\"0\">one</label>", sw.ToString (), "A1");
		}
 void System.Web.UI.WebControls.IRepeatInfoUser.RenderItem(ListItemType itemType, int repeatIndex, RepeatInfo repeatInfo, System.Web.UI.HtmlTextWriter writer)
 {
 }
 protected override void RenderItem(System.Web.UI.WebControls.ListItemType itemType, int repeatIndex, System.Web.UI.WebControls.RepeatInfo repeatInfo, System.Web.UI.HtmlTextWriter writer)
 {
     //If String.IsNullOrEmpty(Me.Items(repeatIndex).Value) Then
     //    writer.AddAttribute("onclick", "CheckBoxList_SetAll('" & ClientID & "', " & Items.Count.ToString() & ", this.checked);")
     //End If
     base.RenderItem(itemType, repeatIndex, repeatInfo, writer);
 }
Beispiel #41
0
		protected virtual void RenderItem (ListItemType itemType, int repeatIndex, RepeatInfo repeatInfo, HtmlTextWriter writer)
		{
			ListItem item = Items [repeatIndex];

			string cssClass = check_box.CssClass;
			if (!String.IsNullOrEmpty (cssClass))
				check_box.CssClass = String.Empty;
			check_box.ID = repeatIndex.ToString (Helpers.InvariantCulture);
			check_box.Text = item.Text;
			check_box.AutoPostBack = AutoPostBack;
			check_box.Checked = item.Selected;
			check_box.TextAlign = TextAlign;
			if (!IsEnabled)
				check_box.Enabled = false;
			else
				check_box.Enabled = item.Enabled;

			check_box.ValidationGroup = ValidationGroup;
			check_box.CausesValidation = CausesValidation;
			if (check_box.HasAttributes)
				check_box.Attributes.Clear ();
			if (item.HasAttributes)
				check_box.Attributes.CopyFrom (item.Attributes);
#if NET_4_0
			if (!RenderingCompatibilityLessThan40) {
				var attrs = check_box.InputAttributes;
			
				attrs.Clear ();
				attrs.Add ("value", item.Value);
			}
#endif
			check_box.RenderControl (writer);
		}
Beispiel #42
0
		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);
		}
		public new string RenderItem (ListItemType itemType, int repeatIndex, RepeatInfo repeatInfo)
		{
			HtmlTextWriter writer = new HtmlTextWriter (new StringWriter ());
			base.RenderItem(itemType,repeatIndex,repeatInfo,writer);
			return writer.InnerWriter.ToString ();
		}
 /// <internalonly/>
 /// <devdoc>
 /// Called by the RepeatInfo helper to render each item
 /// </devdoc>
 void IRepeatInfoUser.RenderItem(ListItemType itemType, int repeatIndex, RepeatInfo repeatInfo, HtmlTextWriter writer)
 {
     RenderItem(itemType, repeatIndex, repeatInfo, writer);
 }
Beispiel #45
0
		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;
		}
 protected override void RenderItem(ListItemType itemType, int repeatIndex, RepeatInfo repeatInfo, HtmlTextWriter writer)
 {
     Items[repeatIndex].Attributes.Add("onclick",
                                      string.Format("skm_Uncheck({0}, {1});",
                                                    ClientID, repeatIndex));
       Items[repeatIndex].Attributes.Add("idex", ClientID + repeatIndex.ToString());
       base.RenderItem(itemType, repeatIndex, repeatInfo, writer);
 }
Beispiel #47
0
		public void RepeatLayout_Invalid ()
		{
			RepeatInfo ri = new RepeatInfo ();
			ri.RepeatLayout = (RepeatLayout) Int32.MinValue;
		}
Beispiel #48
0
		public void DefaultValues ()
		{
			RepeatInfo ri = new RepeatInfo ();
			Assert.AreEqual (0, ri.RepeatColumns, "RepeatColumns");
			Assert.AreEqual (RepeatDirection.Vertical, ri.RepeatDirection, "RepeatDirection");
			Assert.AreEqual (RepeatLayout.Table, ri.RepeatLayout, "RepeatLayout");
			Assert.IsFalse (ri.OuterTableImplied, "OuterTableImplied");
		}
 protected virtual new void RenderItem(ListItemType itemType, int repeatIndex, RepeatInfo repeatInfo, System.Web.UI.HtmlTextWriter writer)
 {
 }
		public void RepeatInfoRenderItem ()
		{
#if NET_4_0
			string origHtml = "<input id=\"0\" type=\"checkbox\" name=\"0\" value=\"one\" /><label for=\"0\">one</label>";
#else
			string origHtml = "<input id=\"0\" type=\"checkbox\" name=\"0\" /><label for=\"0\">one</label>";
#endif
			StringWriter sw = new StringWriter ();
			HtmlTextWriter tw = new HtmlTextWriter (sw);
			CheckBoxList c = new CheckBoxList ();
			IRepeatInfoUser ri = (IRepeatInfoUser) c;
			RepeatInfo r = new RepeatInfo ();

			c.Items.Add ("one");
			c.Items.Add ("two");

			ri.RenderItem (ListItemType.Item, 0, r, tw);
			string html = sw.ToString ();
			Assert.AreEqual (origHtml, html, "A1");
		}
Beispiel #51
0
		public void RepeatColumns_Negative ()
		{
			RepeatInfo ri = new RepeatInfo ();
			ri.RepeatColumns = -1;
			Assert.AreEqual (-1, ri.RepeatColumns, "-1");
			ri.RepeatColumns = Int32.MinValue;
			Assert.AreEqual (Int32.MinValue, ri.RepeatColumns, "Int32.MinValue");
		}
		protected virtual void RenderItem (System.Web.UI.WebControls.ListItemType itemType, int repeatIndex, RepeatInfo repeatInfo, HtmlTextWriter writer)
Beispiel #53
0
		public void RepeatDirection_Invalid ()
		{
			RepeatInfo ri = new RepeatInfo ();
			ri.RepeatDirection = (RepeatDirection) Int32.MinValue;
		}