HtmlTable.HtmlTableRowControlCollection-Klasse
Stellt eine Auflistung von HtmlTableRow-Objekten dar, die die Zeilen eines HtmlTable-Steuerelements sind.
Namespace: System.Web.UI.HtmlControls
Assembly: System.Web (in system.web.dll)
Syntax
'Declaration
Protected Class HtmlTableRowControlCollection
Inherits ControlCollection
'Usage
Dim instance As HtmlTableRowControlCollection
protected class HtmlTableRowControlCollection : ControlCollection
private ref class HtmlTableRowControlCollection : public ControlCollection
protected class HtmlTableRowControlCollection extends ControlCollection
protected class HtmlTableRowControlCollection extends ControlCollection
Hinweise
Die HtmlTable.HtmlTableRowControlCollection-Klasse stellt eine Auflistung von HtmlTableRow-Objekten für ein HtmlTable-Steuerelement dar. Steuerelemente können mit der Add-Methode am Ende der Auflistung oder mit der AddAt-Methode an einer angegebenen Indexposition innerhalb der Auflistung hinzugefügt werden. Zur HtmlTable.HtmlTableRowControlCollection-Auflistung können nur Steuerelemente vom Typ HtmlTableRow hinzugefügt werden.
Beispiel
Im folgenden Codebeispiel wird das Erstellen einer benutzerdefinierten HtmlTable.HtmlTableRowControlCollection veranschaulicht, die die Add-Methode überschreibt, sodass Zeilen, die zu einer Tabelle hinzugefügt werden, immer am Anfang der Zeilenauflistung der Tabelle eingefügt werden.
<%@ Register TagPrefix="aspSample" Namespace="Samples.AspNet.VB.Controls" Assembly="Samples.AspNet.VB" %>
<%@ Page Language="VB" AutoEventWireup="True" %>
<html>
<head>
<title>Custom HtmlTable - CustomHtmlTableRowControlCollection Example</title>
</head>
<body>
<form id="Form1"
method="post"
runat="server">
<h3>Custom HtmlTable - CustomHtmlTableRowControlCollection Example</h3>
<aspSample:CustomHtmlTableRowControlCollection
id="HtmlTable1"
name="HtmlTable1"
runat="server"
border="1"
cellSpacing="0"
cellPadding="5">
<TR>
<TD>1,1</TD>
<TD>1,2</TD>
<TD>1,3</TD>
</TR>
<TR>
<TD>2,1</TD>
<TD>2,2</TD>
<TD>2,3</TD>
</TR>
<TR>
<TD>3,1</TD>
<TD>3,2</TD>
<TD>3,3</TD>
</TR>
</aspSample:CustomHtmlTableRowControlCollection>
</form>
</body>
</html>
<%@ Register TagPrefix="aspSample" Namespace="Samples.AspNet.CS.Controls" Assembly="Samples.AspNet.CS" %>
<%@ Page Language="C#" AutoEventWireup="True" %>
<html>
<head>
<title>Custom HtmlTable - CustomHtmlTableRowControlCollection Example</title>
</head>
<body>
<form id="Form1"
method="post"
runat="server">
<h3>Custom HtmlTable - CustomHtmlTableRowControlCollection Example</h3>
<aspSample:CustomHtmlTableRowControlCollection
id="HtmlTable1"
name="HtmlTable1"
runat="server"
border="1"
cellSpacing="0"
cellPadding="5">
<TR>
<TD>1,1</TD>
<TD>1,2</TD>
<TD>1,3</TD>
</TR>
<TR>
<TD>2,1</TD>
<TD>2,2</TD>
<TD>2,3</TD>
</TR>
<TR>
<TD>3,1</TD>
<TD>3,2</TD>
<TD>3,3</TD>
</TR>
</aspSample:CustomHtmlTableRowControlCollection>
</form>
</body>
</html>
Imports System.Web
Imports System.Web.UI
Imports System.Security.Permissions
Namespace Samples.AspNet.VB.Controls
<AspNetHostingPermission(SecurityAction.Demand, Level:=AspNetHostingPermissionLevel.Minimal)> _
Public NotInheritable Class CustomHtmlTableRowControlCollection
Inherits System.Web.UI.HtmlControls.HtmlTable
Protected Overrides Function CreateControlCollection() As System.Web.UI.ControlCollection
Return New MyHtmlTableRowControlCollection(Me)
End Function
Protected Class MyHtmlTableRowControlCollection
Inherits ControlCollection
Friend Sub New(ByVal owner As Control)
MyBase.New(owner)
End Sub
Public Overrides Sub Add(ByVal child As Control)
' Always add new rows at the top of the table.
MyBase.AddAt(0, child)
End Sub
End Class
End Class
End Namespace
using System.Web;
using System.Web.UI;
using System.Security.Permissions;
namespace Samples.AspNet.CS.Controls
{
[AspNetHostingPermission(SecurityAction.Demand, Level = AspNetHostingPermissionLevel.Minimal)]
public class CustomHtmlTableRowControlCollection : System.Web.UI.HtmlControls.HtmlTable
{
protected override ControlCollection CreateControlCollection()
{
return new MyHtmlTableRowControlCollection(this);
}
protected class MyHtmlTableRowControlCollection : ControlCollection
{
internal MyHtmlTableRowControlCollection(Control owner) : base(owner) { }
public override void Add(Control child)
{
// Always add new rows at the top of the table.
base.AddAt(0, child);
}
}
}
}
.NET Framework-Sicherheit
- AspNetHostingPermission für den Betrieb in einer Hostumgebung. Anforderungswert: LinkDemand, Berechtigungswert: Minimal
- AspNetHostingPermission für den Betrieb in einer Hostumgebung. Anforderungswert: InheritanceDemand, Berechtigungswert: Minimal
Vererbungshierarchie
System.Object
System.Web.UI.ControlCollection
System.Web.UI.HtmlControls.HtmlTable.HtmlTableRowControlCollection
Threadsicherheit
Alle öffentlichen statischen (Shared in Visual Basic) Member dieses Typs sind threadsicher. Bei Instanzmembern ist die Threadsicherheit nicht gewährleistet.
Plattformen
Windows 98, Windows 2000 SP4, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
.NET Framework unterstützt nicht alle Versionen sämtlicher Plattformen. Eine Liste der unterstützten Versionen finden Sie unter Systemanforderungen.
Versionsinformationen
.NET Framework
Unterstützt in: 2.0, 1.1, 1.0
Siehe auch
Referenz
HtmlTable.HtmlTableRowControlCollection-Member
System.Web.UI.HtmlControls-Namespace
CreateControlCollection
ControlCollection