Moving Controls Between Panels

With the concept of a Label or Panel being able to have an arbitrary number of child controls, we use this example to show how you can dynamically change a control's parent, to essentially "move" a control from one panel to the next.

The example below has two Panel controls, as well as ten TextBox controls who's parents are one of the panels. The buttons have Ajax actions which will move the textboxes back and forth between the panels, or remove the textbox altogether.

Again, note that we are not hard coding a $objTextBox->render() anywhere in our code. We are simply using the concept of ParentControls and using the two BlockControl controls' AutoRenderChildren functionality to dynamically render the textboxes in the appropriate places.

Finally, notice that while we are doing this using AJAX-based actions, you can just as easily use Server-based actions as well.