System.Web.UI Namespace ControlCollection Class
Inserts a control at the specified index in a ControlCollection.
[ VB ]
Public Sub AddAt ( _
ByVal index As Integer, _
ByVal child As Control _
)
[ C# ]
public void AddAt (
int index,
Control child
);
[ C++ ]
public: void AddAt (
int index,
Control* child
);
[ JScript ]
public function AddAt (
index : int,
child : Control
);
- index
- The location in the collection in which to add the Control.
- child
- The Control to insert into the location.
Use this method to insert a Control object at the specified index location in the ControlCollection. The control can be an instance of any ASP.NET server control, a literal control, or a custom server control that you create.
To append a Control to the end of the collection, use the Add method.
The following example shows use of the AddAt method to programmatically insert a control at the specified index location in a ControlCollection at run time.
// instantiate a new control
Control control = new Control ( );
// add the control to the Controls collection
myControl.Controls.AddAt ( 0, control );
' instantiate a new control
Dim control As New Control ( )
' add the control to the Controls collection
myControl.Controls.AddAt ( 0, control ) |
|
C# |
VB |
Show me
ControlCollection Members Controls.Add Controls.Remove Controls.RemoveAt Controls.Clear