/// <devdoc>
        ///    <para>Registers client script for generating postback prior to
        ///       rendering on the client if <see cref='System.Web.UI.WebControls.CheckBox.AutoPostBack'/> is
        ///    <see langword='true'/>.</para>
        /// </devdoc>
        protected internal override void OnPreRender(EventArgs e)
        {
            base.OnPreRender(e);
            bool autoPostBack = AutoPostBack;

            if (Page != null && IsEnabled)
            {
                // we always need to get post back data
                Page.RegisterRequiresPostBack(this);
                if (autoPostBack)
                {
                    Page.RegisterPostBackScript();
                    Page.RegisterFocusScript();

                    // VSWhidbey 489577: It would handle both CheckBox and RadioButton cases
                    if (CausesValidation && Page.GetValidators(ValidationGroup).Count > 0)
                    {
                        Page.RegisterWebFormsScript();
                    }
                }
            }

            if (!SaveCheckedViewState(autoPostBack))
            {
                ViewState.SetItemDirty("Checked", false);

                if ((Page != null) && IsEnabled)
                {
                    // Store a client-side array of enabled control, so we can re-enable them on
                    // postback (in case they are disabled client-side)
                    Page.RegisterEnabledControl(this);
                }
            }
        }
예제 #2
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);
            }
        }
예제 #3
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);
            }
        }
예제 #4
0
 /*
  *
  */
 /// <include file='doc\HtmlInputHidden.uex' path='docs/doc[@for="HtmlInputHidden.OnPreRender"]/*' />
 /// <internalonly/>
 /// <devdoc>
 /// </devdoc>
 protected override void OnPreRender(EventArgs e)
 {
     // if no change handler, no need to save posted property
     if (Events[EventServerChange] == null && !Disabled)
     {
         ViewState.SetItemDirty("value", false);
     }
 }
예제 #5
0
 protected override object SaveViewState()
 {
     if (TextMode == TextBoxMode.Password)
     {
         ViewState.SetItemDirty("Text", false);
     }
     return(base.SaveViewState());
 }
예제 #6
0
 protected override object SaveViewState()
 {
     if (SaveTextViewState == false)
     {
         ViewState.SetItemDirty("Text", false);
     }
     return(base.SaveViewState());
 }
 protected internal override void OnPreRender(EventArgs e)
 {
     base.OnPreRender(e);
     if (SaveValueViewState == false)
     {
         ViewState.SetItemDirty("Value", false);
     }
 }
예제 #8
0
 /// <summary>
 /// Notifies the ToolCheckBox control to perform any necessary prerendering steps prior to saving view state and rendering content.
 /// </summary>
 /// <param name="e">An EventArgs object that contains the event data.</param>
 protected override void OnPreRender(EventArgs e)
 {
     if (Page != null && Enabled)
     {
         base.Page.RegisterRequiresPostBack(this);
     }
     if (!SaveCheckedViewState)
     {
         ViewState.SetItemDirty("Checked", false);
     }
 }
예제 #9
0
        /*
         * This method is invoked just prior to rendering.
         */
        /// <include file='doc\HtmlInputRadioButton.uex' path='docs/doc[@for="HtmlInputRadioButton.OnPreRender"]/*' />
        /// <internalonly/>
        /// <devdoc>
        /// </devdoc>
        protected override void OnPreRender(EventArgs e)
        {
            if (Page != null && !Disabled)
            {
                Page.RegisterRequiresPostBack(this);
            }

            // if no change handler, no need to save posted property
            if (Events[EventServerChange] == null && !Disabled)
            {
                ViewState.SetItemDirty("checked", false);
            }
        }
예제 #10
0
        /// <include file='doc\TextBox.uex' path='docs/doc[@for="TextBox.OnPreRender"]/*' />
        /// <internalonly/>
        protected override void OnPreRender(EventArgs e)
        {
            base.OnPreRender(e);
            if (SaveTextViewState == false)
            {
                ViewState.SetItemDirty("Text", false);
            }

            if (Page != null && AutoPostBack && Enabled)
            {
                Page.RegisterPostBackScript();
            }
        }
예제 #11
0
        /// <include file='doc\CheckBox.uex' path='docs/doc[@for="CheckBox.OnPreRender"]/*' />
        /// <internalonly/>
        /// <devdoc>
        ///    <para>Registers client script for generating postback prior to
        ///       rendering on the client if <see cref='System.Web.UI.WebControls.CheckBox.AutoPostBack'/> is
        ///    <see langword='true'/>.</para>
        /// </devdoc>
        protected override void OnPreRender(EventArgs e)
        {
            if (Page != null && Enabled)
            {
                // we always need to get post back data
                Page.RegisterRequiresPostBack(this);
                if (AutoPostBack)
                {
                    Page.RegisterPostBackScript();
                }
            }

            if (SaveCheckedViewState == false)
            {
                ViewState.SetItemDirty("Checked", false);
            }
        }
        /*
         *
         */

        /// <internalonly/>
        /// <devdoc>
        /// </devdoc>
        protected internal override void OnPreRender(EventArgs e)
        {
            base.OnPreRender(e);

            // if no change handler, no need to save posted property
            if (!Disabled)
            {
                if (Events[EventServerChange] == null)
                {
                    ViewState.SetItemDirty("value", false);
                }

                if (Page != null)
                {
                    Page.RegisterEnabledControl(this);
                }
            }
        }
        /// <summary>
        /// Do the insert in the DataBase
        /// </summary>
        private void DataBaseCreate()
        {
            // Insert error
            FormMode          = ActionEditorFormMode.New;
            DataBaseOperation = ActionDataBaseOperation.None;

            Page.Validate();
            if (Page.IsValid)
            {
                if (_actionDataBase.CreateRecord(GetFieldValuesFromControls(), FilterValues) > 0)
                {
                    // Ok
                    FormMode          = ActionEditorFormMode.View;
                    DataBaseOperation = ActionDataBaseOperation.NextTimeRead;
                    ViewState.SetItemDirty("FilterValues", true);
                }
            }
        }
예제 #14
0
        /*
         * This method is invoked just prior to rendering.
         */

        /// <internalonly/>
        /// <devdoc>
        /// </devdoc>
        protected internal override void OnPreRender(EventArgs e)
        {
            base.OnPreRender(e);

            if (Page != null && !Disabled)
            {
                Page.RegisterRequiresPostBack(this);

                Page.RegisterEnabledControl(this);
            }

            // if no change handler, no need to save posted property unless
            // we are disabled
            if (Events[EventServerChange] == null && !Disabled)
            {
                ViewState.SetItemDirty("checked", false);
            }
        }
        /*
         *
         */

        /// <internalonly/>
        /// <devdoc>
        /// </devdoc>
        protected internal override void OnPreRender(EventArgs e)
        {
            base.OnPreRender(e);

            bool disabled = Disabled;

            if (!disabled && Page != null)
            {
                Page.RegisterEnabledControl(this);
            }

            // if no change handler, no need to save posted property unless we are disabled;
            // VSWhidbey 419040: We should never save password value in ViewState
            if ((!disabled && Events[EventServerChange] == null) ||
                Type.Equals("password", StringComparison.OrdinalIgnoreCase))
            {
                ViewState.SetItemDirty("value", false);
            }
        }
        /// <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);
            }
        }