asp.net.ph

ControlCollection.Item Property

System.Web.UI Namespace   ControlCollection Class


Returns a reference to the server control at the specified index location in a ControlCollection.

Syntax


Control variable = Controls.Item [ index ];
... or ...
Control variable = Controls [ index ];
  C# VB JScript

Parameters

index
An integer specifying the position of the item in the collection.

Return Value

The Control at the specified index.

Exceptions


Exception Type Condition
ArgumentOutOfRangeException Thrown if the index parameter is less than zero or greater than or equal to the ControlCollection.Count property.

Remarks

Use this indexer to get a Control from the ControlCollection. You can access a Control at a specified index by using simple array notation.

For example, if you have a ControlCollection called myControls, you can access the first element in the collection by using the following statement:

Control myControl = myControls.Item [ 0 ];
... or ...
Control myControl = myControls [ 0 ];
  C# VB JScript

NOTE: The collection is zero-based, meaning the first element in the collection returns an index value of 0.

See Also

ControlCollection Members 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