This documentation is archived and is not being maintained.

HtmlTableRowCollection.Remove Method

Removes the specified HtmlTableRow object from the HtmlTableRowCollection collection.

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

public void Remove(
	HtmlTableRow row

Use this method to remove the specified HtmlTableRow object from the HtmlTableRowCollection collection.


If you specify an HtmlTableRow that does not exist in the HtmlTableRowCollection, no item is removed from the collection.

The following code example demonstrates how to use the Remove method to remove the specified table row, represented by an HtmlTableRow object, from the HtmlTableRowCollection collection. This example removes the cells from the first row of the HtmlTable control.

<%@ Page Language="C#" AutoEventWireup="True" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
<script runat="server">

  void Button_Click(Object sender, EventArgs e)

    // Remove the first row from the table.
    HtmlTableRow row = Table1.Rows[0];



<html xmlns="" >

   <form id="form1" runat="server">

      <h3>HtmlTableRowCollection Example</h3>

          <table id="Table1" runat="server" 
                style="border-width: 1; border-color: Black">
               Cell 1
               Cell 2
               Cell 3
               Cell 4


      <br /><br />

      <input type="button" 
             value="Remove First Row from Table"



Windows 7, Windows Vista, Windows XP SP2, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP Starter Edition, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003, Windows Server 2000 SP4, Windows Millennium Edition, Windows 98

The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

.NET Framework

Supported in: 3.5, 3.0, 2.0, 1.1, 1.0