/// <summary> /// Adds all controls on this panel to the containing <see cref="UserControl.BindingManager"/>'s binding collection. /// </summary> /// <param name="bindingContainer">the usercontrol containing this panel</param> /// <param name="controls">the <see cref="ControlCollection"/> of controls to be bound</param> /// <param name="action">action to be performed on matching controls</param> private void TraverseControls(IWebDataBound bindingContainer, ControlCollection controls, TraversalAction action) { foreach (Control control in controls) { // DataBindingPanels must not be nested if (control is DataBindingPanel) { throw new HttpException("Controls of type DataBindingPanel must not be nested"); } // abort recursion on LiteralControl or nested UserControl if (control is LiteralControl || control is UserControl) { continue; } // if it's a WebControl, check for binding-related attributes WebControl wc = control as WebControl; if (wc != null) { try { action(bindingContainer, wc); } catch (Exception ex) { string msg = string.Format("Error executing action on control '{0}' of type '{1}'", wc.UniqueID, wc.GetType().FullName); Log.Error(msg, ex); throw new HttpException(msg, ex); } } if (control.HasControls()) { this.TraverseControls(bindingContainer, control.Controls, action); } } }
public PostOrderTraversal(TraversalAction action) : base(action) { }
public BSTTraversal(TraversalAction action) { this.action = action; }
public InOrderTraversal(TraversalAction action) : base(action) { }