System.Web.UI.Control.PreRenderRecursiveInternal C# (CSharp) Method

PreRenderRecursiveInternal() private method

private PreRenderRecursiveInternal ( ) : void
return void
		internal void PreRenderRecursiveInternal ()
		{
			bool visible;

			visible = Visible;			
			if (visible) {
				SetMask (VISIBLE, true);
				EnsureChildControls ();
#if MONO_TRACE
				TraceContext trace = (Context != null && Context.Trace.IsEnabled) ? Context.Trace : null;
				string type_name = null;
				if (trace != null) {
					type_name = GetType ().Name;
					trace.Write ("control", String.Concat ("PreRenderRecursive ", _userId, " ", type_name));
				}
#endif
				if (Adapter != null)
					Adapter.OnPreRender (EventArgs.Empty);
				else
					OnPreRender (EventArgs.Empty);
				if (!HasControls ())
					return;

				int len = _controls != null ? _controls.Count : 0;
				for (int i = 0; i < len; i++) {
					Control c = _controls [i];
					c.PreRenderRecursiveInternal ();
				}
#if MONO_TRACE
				if (trace != null)
					trace.Write ("control", String.Concat ("End PreRenderRecursive ", _userId, " ", type_name));
#endif
			} else
				SetMask (VISIBLE, false);
			
			stateMask |= PRERENDERED;
		}
#if NET_4_0

Usage Example

Example #1
0
        /// <devdoc>
        /// </devdoc>
        protected internal virtual void AddedControl(Control control, int index) {
            if (control.OwnerControl != null) {
                throw new InvalidOperationException(SR.GetString(SR.Substitution_NotAllowed));
            }

            if (control._parent != null) {
                control._parent.Controls.Remove(control);
            }

            control._parent = this;
            control._page = Page;
            control.flags.Clear(designModeChecked);

            // We only add to naming container if it is available. Otherwise, it will be pushed through
            // during InitRecursive
            Control namingContainer = flags[isNamingContainer] ? this : _namingContainer;
            if (namingContainer != null) {
                control.UpdateNamingContainer(namingContainer);
                if (control._id == null && !control.flags[idNotRequired]) {
                    // this will also dirty the name table in the naming container
                    control.GenerateAutomaticID();
                }
                else if (control._id != null || (control._controls != null)) {
                    // If the control has and ID, or has children (which *may* themselves
                    // have ID's), we need to dirty the name table (ASURT 100557)
                    namingContainer.DirtyNameTable();
                }
            }

            /*
             * The following is for times when AddChild is called after CreateChildControls. This
             * allows users to add children at any time in the creation process without having
             * to understand the underlying machinery.
             * Note that if page is null, it means we haven't been attached to a container ourselves.
             * If this is true, when we are, our children will be recursively set up.
             */
            if (_controlState >= ControlState.ChildrenInitialized) {

                Debug.Assert(namingContainer != null);
                control.InitRecursive(namingContainer);

                // VSWhidbey 396372: We need to reregister the control state if the control is reparented because the control
                // is unregistered during unload, but its already been inited once, so it will not get its Init called again
                // which is where most controls call RegisterRequiresControlState
                if (control._controlState >= ControlState.Initialized &&
                    control.RareFields != null &&
                    control.RareFields.RequiredControlState) {
                    Page.RegisterRequiresControlState(control);
                }

                if (_controlState >= ControlState.ViewStateLoaded) {
                    object viewState = null;
                    if(_occasionalFields != null && _occasionalFields.ControlsViewState != null) {
                        viewState = _occasionalFields.ControlsViewState[index];
                        // This solution takes the conservative approach that once viewstate has been
                        // applied to a child control, it is thrown away.  This eliminates inadvertently
                        // setting viewstate on the wrong control, which can occur in scenarios where
                        // the child control collection is being manipulated via code.  Probably need
                        // to provide a feature where programmer can control whether to reapply viewstate
                        // or not.
                        if (LoadViewStateByID) {
                            control.EnsureID();
                            viewState = _occasionalFields.ControlsViewState[control.ID];
                            _occasionalFields.ControlsViewState.Remove(control.ID);
                        }
                        else {
                            viewState = _occasionalFields.ControlsViewState[index];
                            _occasionalFields.ControlsViewState.Remove(index);
                        }
                    }

                    control.LoadViewStateRecursive(viewState);

                    if (_controlState >= ControlState.Loaded) {
                        control.LoadRecursive();

                        if (_controlState >= ControlState.PreRendered)
                            control.PreRenderRecursiveInternal();
                    }
                }
            }
        }
All Usage Examples Of System.Web.UI.Control::PreRenderRecursiveInternal