TableRow.CellControlCollection 類別

定義

表示 TableCell 物件的集合,這些物件是 TableRow 控制項的儲存格。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
繼承
TableRow.CellControlCollection

範例

下列程式碼範例示範如何建立資料表、以程式設計方式將專案加入至資料表,然後在網頁上顯示資料表。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. 請注意 Cells 控制項的屬性如何 TableRow 表示 TableRow.CellControlCollection 集合,以及如何 Add 使用方法將資料格加入至資料列。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.

這個程式碼範例是針對類別提供之較大範例的一部分 TableRowThis 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

備註

TableRow.CellControlCollection類別代表控制項物件的集合 TableCell TableRowThe TableRow.CellControlCollection class represents the collection of TableCell objects of a TableRow control. TableCell您可以使用方法,或在中的 TableRow.CellControlCollection Add 指定索引位置,利用方法,將物件加入至集合結尾 TableRow.CellControlCollection AddAtTableCell 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.

只有 TableCell 物件可以加入至 TableRow.CellControlCollection 集合。Only TableCell objects can be added to the TableRow.CellControlCollection collection.

屬性

Count

取得指定 ASP.NET 伺服器控制項的 ControlCollection 物件中的伺服器控制項數目。Gets the number of server controls in the ControlCollection object for the specified ASP.NET server control.

(繼承來源 ControlCollection)
IsReadOnly

取得值,這個值表示 ControlCollection 物件是否唯讀。Gets a value indicating whether the ControlCollection object is read-only.

(繼承來源 ControlCollection)
IsSynchronized

取得值,該值指出是否同步處理 ControlCollection 物件。Gets a value indicating whether the ControlCollection object is synchronized.

(繼承來源 ControlCollection)
Item[Int32]

取得在 ControlCollection 物件中指定索引位置之伺服器控制項的參考。Gets a reference to the server control at the specified index location in the ControlCollection object.

(繼承來源 ControlCollection)
Owner

取得 ControlCollection 物件所屬的 ASP.NET 伺服器控制項。Gets the ASP.NET server control to which the ControlCollection object belongs.

(繼承來源 ControlCollection)
SyncRoot

取得可用來對控制項集合進行同步 (Synchronize) 存取的物件。Gets an object that can be used to synchronize access to the collection of controls.

(繼承來源 ControlCollection)

方法

Add(Control)

將指定的 Control 物件加入至 TableRow.CellControlCollection 集合中。Adds the specified Control object to the TableRow.CellControlCollection collection.

AddAt(Int32, Control)

將指定的 Control 物件加入至 TableRow.CellControlCollection 集合中。Adds the specified Control object to the TableRow.CellControlCollection collection. 新控制項加入至指定索引位置的陣列。The new control is added to the array at the specified index location.

Clear()

從目前伺服器控制項的 ControlCollection 物件中移除所有控制項。Removes all controls from the current server control's ControlCollection object.

(繼承來源 ControlCollection)
Contains(Control)

判斷指定伺服器控制項是否在伺服器控制項的 ControlCollection 物件之中。Determines whether the specified server control is in the parent server control's ControlCollection object.

(繼承來源 ControlCollection)
CopyTo(Array, Int32)

ControlCollection 中的指定索引位置開始,複製儲存於 Array 物件的子控制項至 Array 物件。Copies the child controls stored in the ControlCollection object to an Array object, beginning at the specified index location in the Array.

(繼承來源 ControlCollection)
Equals(Object)

判斷指定的物件是否等於目前的物件。Determines whether the specified object is equal to the current object.

(繼承來源 Object)
GetEnumerator()

擷取可逐一查看 ControlCollection 物件的列舉值。Retrieves an enumerator that can iterate through the ControlCollection object.

(繼承來源 ControlCollection)
GetHashCode()

做為預設雜湊函式。Serves as the default hash function.

(繼承來源 Object)
GetType()

取得目前執行個體的 TypeGets the Type of the current instance.

(繼承來源 Object)
IndexOf(Control)

擷取集合中指定 Control 物件的索引。Retrieves the index of a specified Control object in the collection.

(繼承來源 ControlCollection)
MemberwiseClone()

建立目前 Object 的淺層複製。Creates a shallow copy of the current Object.

(繼承來源 Object)
Remove(Control)

從父伺服器控制項的 ControlCollection 物件移除指定伺服器控制項。Removes the specified server control from the parent server control's ControlCollection object.

(繼承來源 ControlCollection)
RemoveAt(Int32)

在指定索引位置,從 ControlCollection 物件移除子控制項。Removes a child control, at the specified index location, from the ControlCollection object.

(繼承來源 ControlCollection)
ToString()

傳回代表目前物件的字串。Returns a string that represents the current object.

(繼承來源 Object)

擴充方法

Cast<TResult>(IEnumerable)

IEnumerable 的項目轉換成指定的型別。Casts the elements of an IEnumerable to the specified type.

OfType<TResult>(IEnumerable)

根據指定的型別來篩選 IEnumerable 的項目。Filters the elements of an IEnumerable based on a specified type.

AsParallel(IEnumerable)

啟用查詢的平行化作業。Enables parallelization of a query.

AsQueryable(IEnumerable)

IEnumerable 轉換成 IQueryableConverts an IEnumerable to an IQueryable.

適用於

另請參閱