HtmlTableRowCollection.Remove Method (HtmlTableRow)


The .NET API Reference documentation has a new home. Visit the .NET API Browser on to see the new experience.

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
Available since 1.1
Return to top