.NET Framework Class Library TableRow..::.CellControlCollection Class Represents a collection of TableCell objects that are the cells of a TableRow control.

Inheritance Hierarchy
Namespace:
System.Web.UI.WebControls
Assembly:
System.Web (in System.Web.dll)

Syntax
Protected Class CellControlCollection _
Inherits ControlCollection
protected class CellControlCollection : ControlCollection
protected ref class CellControlCollection : public ControlCollection
type CellControlCollection =
class
inherit ControlCollection
end
The TableRow..::.CellControlCollection type exposes the following members.

Properties

Methods

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.

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.
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
// 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);
}

Version Information
.NET FrameworkSupported in: 4, 3.5, 3.0, 2.0, 1.1, 1.0

Platforms
Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows XP SP2 x64 Edition, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role not supported), Windows Server 2003 SP2
The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

Thread Safety
Any public static ( Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

See Also
|
Bibliothèque de classes .NET Framework TableRow..::.CellControlCollection, classe Représente une collection d'objets TableCell qui sont les cellules d'un contrôle TableRow.

Hiérarchie d'héritage
Espace de noms :
System.Web.UI.WebControls
Assembly :
System.Web (dans System.Web.dll)

Syntaxe
Protected Class CellControlCollection _
Inherits ControlCollection
protected class CellControlCollection : ControlCollection
protected ref class CellControlCollection : public ControlCollection
type CellControlCollection =
class
inherit ControlCollection
end
Le type TableRow..::.CellControlCollection expose les membres suivants.

Propriétés

Méthodes

Notes
La classe TableRow..::.CellControlCollection représente la collection d'objets TableCell d'un contrôle TableRow. Des objets TableCell peuvent être ajoutés à la fin de la collection TableRow..::.CellControlCollection avec la méthode Add, ou à une position d'index spécifiée dans TableRow..::.CellControlCollection avec la méthode AddAt. Seuls les objets TableCell peuvent être ajoutés à la collection TableRow..::.CellControlCollection.

Exemples
L'exemple de code suivant montre comment créer une table, ajouter par programme des éléments à la table et afficher la table sur la page Web. Notez comment la propriété Cells du contrôle TableRow représente une collection TableRow..::.CellControlCollection et comment la méthode Add est utilisée pour ajouter des cellules à la ligne. Cet exemple de code fait partie d'un exemple plus développé fourni pour la classe TableRow.
' 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
// 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);
}

Informations de version
.NET FrameworkPris en charge dans : 4, 3.5, 3.0, 2.0, 1.1, 1.0

Plateformes
Windows 7, Windows Vista SP1 ou ultérieur, Windows XP SP3, Windows XP SP2 Édition x64, Windows Server 2008 (installation minimale non prise en charge), Windows Server 2008 R2 (installation minimale prise en charge avec SP1 ou version ultérieure), Windows Server 2003 SP2
Le .NET Framework ne prend pas en charge toutes les versions de chaque plateforme. Pour obtenir la liste des versions prises en charge, consultez Configuration requise du .NET Framework.

Sécurité des threads
Tous les membres static ( Shared en Visual Basic) publics de ce type sont thread-safe. Il n'est pas garanti que les membres d'instance soient thread-safe.

Voir aussi
|