Ejemplo n.º 1
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);
            }
        }
 protected internal override void OnPreRender(EventArgs e)
 {
     base.OnPreRender(e);
     this._controlToRepeat.AutoPostBack     = this.AutoPostBack;
     this._controlToRepeat.CausesValidation = this.CausesValidation;
     this._controlToRepeat.ValidationGroup  = this.ValidationGroup;
     if (this.Page != null)
     {
         for (int i = 0; i < this.Items.Count; i++)
         {
             ListControl.SetControlToRepeatID(this, this._controlToRepeat, i);
             this.Page.RegisterRequiresPostBack(this._controlToRepeat);
         }
     }
 }
        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);
        }