HtmlTable.HtmlTableRowControlCollection Class

Represents a collection of HtmlTableRow objects that are the rows of an HtmlTable control.

Namespace: System.Web.UI.HtmlControls
Assembly: System.Web (in system.web.dll)

protected class HtmlTableRowControlCollection : ControlCollection
protected class HtmlTableRowControlCollection extends ControlCollection
protected class HtmlTableRowControlCollection extends ControlCollection
Not applicable.

The HtmlTable.HtmlTableRowControlCollection class represents a collection of HtmlTableRow objects for an HtmlTable control. Controls can be added at the end of the collection with the Add method, or at a specified index location in the collection with the AddAt method. Only controls of type HtmlTableRow can be added to the HtmlTable.HtmlTableRowControlCollection collection.

The following code example demonstrates how to create a custom HtmlTable.HtmlTableRowControlCollection that overrides the Add method so that when rows are added to a table, they are always added at the beginning of the table's row collection.

<%@ Register TagPrefix="aspSample" Namespace="Samples.AspNet.CS.Controls" Assembly="Samples.AspNet.CS" %>
<%@ Page Language="C#" AutoEventWireup="True" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
<html xmlns="" >
    <title>Custom HtmlTable - CustomHtmlTableRowControlCollection Example</title>
    <form id="Form1" 
      <h3>Custom HtmlTable - CustomHtmlTableRowControlCollection Example</h3>



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);




  • AspNetHostingPermission  for operating in a hosted environment. Demand value: LinkDemand; Permission value: Minimal.
  • AspNetHostingPermission  for operating in a hosted environment. Demand value: InheritanceDemand; Permission value: Minimal.


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

Windows 98, Windows Server 2000 SP4, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0, 2.0, 1.1, 1.0

Community Additions