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"



.NET Framework

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

Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows XP SP2 x64 Edition, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), 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.