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

UnloadRecursive() private method

private UnloadRecursive ( Boolean dispose ) : void
dispose Boolean
return void
		internal void UnloadRecursive (Boolean dispose)
		{
#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 ("UnloadRecursive ", _userId, " ", type_name));
			}
#endif
			int ccount = _controls != null ? _controls.Count : 0;
			for (int i = 0; i < ccount; i++) {
				Control c = _controls [i];
				c.UnloadRecursive (dispose);
			}

#if MONO_TRACE
			if (trace != null)
				trace.Write ("control", String.Concat ("End UnloadRecursive ", _userId, " ", type_name));
#endif
			ControlAdapter tmp = Adapter;
			if (tmp != null)
				tmp.OnUnload (EventArgs.Empty);
			else
				OnUnload (EventArgs.Empty);
			if (dispose)
				Dispose ();
		}

Usage Example

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

            if ((_namingContainer != null) && (control._id != null)) {
                _namingContainer.DirtyNameTable();
            }

            // Controls may need to do their own cleanup.
            control.UnloadRecursive(false);

            control._parent = null;
            control._page = null;
            control._namingContainer = null;

            // Don't reset template source virtual directory on TemplateControl's, because
            // the path is their own, not their parent. i.e. it doesn't change no matter
            // where in the tree they end up.
            if (!(control is TemplateControl)) {
                if (control._occasionalFields != null) {
                    control._occasionalFields.TemplateSourceVirtualDirectory = null;
                }
            }

            if (control._occasionalFields != null ) {
                control._occasionalFields.TemplateControl = null;
            }

            control.flags.Clear(mustRenderID);
            control.ClearCachedUniqueIDRecursive();
        }
All Usage Examples Of System.Web.UI.Control::UnloadRecursive