コード例 #1
0
        /// <summary>
        /// Overrides <see cref="System.Web.UI.Control.Render"/>
        /// </summary>
        protected override void Render(HtmlTextWriter writer)
        {
            Style["overflow"] = "auto";

            short originalTabIndex = TabIndex;
            bool  tabIndexChanged  = false;

            controlToRepeat.TabIndex = originalTabIndex;
            if (originalTabIndex != 0)
            {
                if (!(ViewState.IsItemDirty("TabIndex")))
                {
                    tabIndexChanged = true;
                }
                TabIndex = 0;
            }

            RenderBeginTag(writer);
            RenderContents(writer);
            RenderEndTag(writer);

            if (originalTabIndex != 0)
            {
                TabIndex = originalTabIndex;
            }
            if (tabIndexChanged)
            {
                ViewState.SetItemDirty("TabIndex", false);
            }
        }
コード例 #2
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);
            }
        }
コード例 #3
0
        /// <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);
            }
        }