Beispiel #1
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 #2
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 #3
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 #4
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);
            }
        }
		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);
		}
		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 = Enabled;
			radio.TabIndex = tabIndex;
#if NET_2_0
			radio.ValidationGroup = ValidationGroup;
			radio.CausesValidation = CausesValidation;
			if (radio.HasAttributes)
				radio.Attributes.Clear ();
			if (item.HasAttributes)
				radio.Attributes.CopyFrom (item.Attributes);
#endif
			radio.RenderControl (writer);
		}