TableRow.CellControlCollection TableRow.CellControlCollection TableRow.CellControlCollection Class

Definition

Represents a collection of TableCell objects that are the cells of a TableRow control.

protected: ref class TableRow::CellControlCollection : System::Web::UI::ControlCollection
protected class TableRow.CellControlCollection : System.Web.UI.ControlCollection
Protected Class TableRow.CellControlCollection
Inherits ControlCollection
Inheritance
TableRow.CellControlCollectionTableRow.CellControlCollectionTableRow.CellControlCollection

Examples

The following code example demonstrates how to create a table, add elements to the table programmatically, and then display the table on the Web page. Note how the Cells property of the TableRow control represents a TableRow.CellControlCollection collection and how the Add method is used to add cells to the row.

This code example is part of a larger example provided for the TableRow class.

// Create more rows for the table.
for (int rowNum = 2; rowNum < 10; rowNum++)
{
    TableRow tempRow = new TableRow();
    for (int cellNum = 0; cellNum < 3; cellNum++)
    {
        TableCell tempCell = new TableCell();
        tempCell.Text = 
            String.Format("({0},{1})", rowNum, cellNum);
        tempRow.Cells.Add(tempCell);
    }
    Table1.Rows.Add(tempRow);
}
' Create more rows for the table.
Dim rowNum As Integer
For rowNum = 2 To 9
    Dim tempRow As New TableRow()
    Dim cellNum As Integer
    For cellNum = 0 To 2
        Dim tempCell As New TableCell()
        tempCell.Text = _
            String.Format("({0},{1})", rowNum, cellNum)
        tempRow.Cells.Add(tempCell)
    Next
    Table1.Rows.Add(tempRow)
Next

Remarks

The TableRow.CellControlCollection class represents the collection of TableCell objects of a TableRow control. TableCell objects can be added at the end of the TableRow.CellControlCollection collection with the Add method or at a specified index location in the TableRow.CellControlCollection with the AddAt method.

Only TableCell objects can be added to the TableRow.CellControlCollection collection.

Methods

Add(Control) Add(Control) Add(Control)

Adds the specified Control object to the TableRow.CellControlCollection collection.

AddAt(Int32, Control) AddAt(Int32, Control) AddAt(Int32, Control)

Adds the specified Control object to the TableRow.CellControlCollection collection. The new control is added to the array at the specified index location.

Clear() Clear() Clear()

Removes all controls from the current server control's ControlCollection object.

(Inherited from ControlCollection)
Contains(Control) Contains(Control) Contains(Control)

Determines whether the specified server control is in the parent server control's ControlCollection object.

(Inherited from ControlCollection)
CopyTo(Array, Int32) CopyTo(Array, Int32) CopyTo(Array, Int32)

Copies the child controls stored in the ControlCollection object to an Array object, beginning at the specified index location in the Array.

(Inherited from ControlCollection)
Equals(Object) Equals(Object) Equals(Object)

Determines whether the specified object is equal to the current object.

(Inherited from Object)
GetEnumerator() GetEnumerator() GetEnumerator()

Retrieves an enumerator that can iterate through the ControlCollection object.

(Inherited from ControlCollection)
GetHashCode() GetHashCode() GetHashCode()

Serves as the default hash function.

(Inherited from Object)
GetType() GetType() GetType()

Gets the Type of the current instance.

(Inherited from Object)
IndexOf(Control) IndexOf(Control) IndexOf(Control)

Retrieves the index of a specified Control object in the collection.

(Inherited from ControlCollection)
MemberwiseClone() MemberwiseClone() MemberwiseClone()

Creates a shallow copy of the current Object.

(Inherited from Object)
Remove(Control) Remove(Control) Remove(Control)

Removes the specified server control from the parent server control's ControlCollection object.

(Inherited from ControlCollection)
RemoveAt(Int32) RemoveAt(Int32) RemoveAt(Int32)

Removes a child control, at the specified index location, from the ControlCollection object.

(Inherited from ControlCollection)
ToString() ToString() ToString()

Returns a string that represents the current object.

(Inherited from Object)

Properties

Count Count Count

Gets the number of server controls in the ControlCollection object for the specified ASP.NET server control.

(Inherited from ControlCollection)
IsReadOnly IsReadOnly IsReadOnly

Gets a value indicating whether the ControlCollection object is read-only.

(Inherited from ControlCollection)
IsSynchronized IsSynchronized IsSynchronized

Gets a value indicating whether the ControlCollection object is synchronized.

(Inherited from ControlCollection)
Item[Int32] Item[Int32] Item[Int32]

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

(Inherited from ControlCollection)
Owner Owner Owner

Gets the ASP.NET server control to which the ControlCollection object belongs.

(Inherited from ControlCollection)
SyncRoot SyncRoot SyncRoot

Gets an object that can be used to synchronize access to the collection of controls.

(Inherited from ControlCollection)

Extension Methods

Cast<TResult>(IEnumerable) Cast<TResult>(IEnumerable) Cast<TResult>(IEnumerable)

Casts the elements of an IEnumerable to the specified type.

OfType<TResult>(IEnumerable) OfType<TResult>(IEnumerable) OfType<TResult>(IEnumerable)

Filters the elements of an IEnumerable based on a specified type.

AsParallel(IEnumerable) AsParallel(IEnumerable) AsParallel(IEnumerable)

Enables parallelization of a query.

AsQueryable(IEnumerable) AsQueryable(IEnumerable) AsQueryable(IEnumerable)

Converts an IEnumerable to an IQueryable.

Applies to

See also