asp.net.ph

ControlCollection.AddAt Method

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
);

Parameters

index
The location in the collection in which to add the Control.
child
The Control to insert into the location.

Exceptions


Exception Type Condition
ArgumentNullException Thrown if the child parameter does not specifiy a control.
ArgumentOutOfRangeException Thrown if the index parameter is less than zero or greater than or equal to the ControlCollection.Count property.
HttpException Thrown if the ControlCollection object is read-only.

Remarks

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.

Example

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 );
  C# VB

 Show me 

See Also

ControlCollection Members   Controls.Add   Controls.Remove   Controls.RemoveAt   Controls.Clear Skip Navigation Links




Home
Suggested Reading


Previous page Back to top Next page

© 2000-2010 Rey Nuñez All rights reserved.

If you have any question, comment or suggestion
about this site, please send us a note

You can help support asp.net.ph