次の方法で共有


HtmlTableRowCollection.Remove メソッド

指定した HtmlTableRow オブジェクトを HtmlTableRowCollection コレクションから削除します。

名前空間: System.Web.UI.HtmlControls
アセンブリ: System.Web (system.web.dll 内)

構文

'宣言
Public Sub Remove ( _
    row As HtmlTableRow _
)
'使用
Dim instance As HtmlTableRowCollection
Dim row As HtmlTableRow

instance.Remove(row)
public void Remove (
    HtmlTableRow row
)
public:
void Remove (
    HtmlTableRow^ row
)
public void Remove (
    HtmlTableRow row
)
public function Remove (
    row : HtmlTableRow
)
適用できません。

パラメータ

解説

このメソッドを使用して、指定した HtmlTableRow オブジェクトを HtmlTableRowCollection コレクションから削除します。

メモメモ :

HtmlTableRowCollection に存在しない HtmlTableRow を指定した場合、項目はコレクションから削除されません。

使用例

Remove メソッドを使用して、HtmlTableRowCollection コレクションから、HtmlTableRow オブジェクトが表す指定したテーブルの行を削除する方法を次のコード例に示します。この例では HtmlTable コントロールの最初の行からセルを削除します。

<%@ Page Language="VB" AutoEventWireup="True" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<script runat="server">

  Sub Button_Click(ByVal sender As Object, ByVal e As EventArgs)
 
    ' Remove the first row from the table.
    Dim row As HtmlTableRow = Table1.Rows(0)
    Table1.Rows.Remove(row)

  End Sub

</script>

<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
   <title>HtmlTableRowCollectionExample</title>
</head>
<body>

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

      <h3>HtmlTableRowCollection Example</h3>

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

         <tr>
            <td>
               Cell 1
            </td>
            <td>
               Cell 2
            </td>
         </tr>
         <tr>
            <td>
               Cell 3
            </td>
            <td>
               Cell 4
            </td>
         </tr>

      </table>


      <br /><br />
  
      <input type="button" 
             value="Remove First Row from Table"
             onserverclick="Button_Click" 
             runat="server"/>

   </form>

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

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<script runat="server">

  void Button_Click(Object sender, EventArgs e)
  {

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

  }

</script>

<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
   <title>HtmlTableRowCollectionExample</title>
</head>
<body>

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

      <h3>HtmlTableRowCollection Example</h3>

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

      </table>


      <br /><br />
  
      <input type="button" 
             value="Remove First Row from Table"
             onserverclick="Button_Click" 
             runat="server"/>

   </form>

</body>
</html>
<%@ Page Language="JScript" AutoEventWireup="True" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<script runat="server">
  function Button_Click(sender, e : EventArgs) 
  {
 
    // Remove the first row from the table.
    var row : HtmlTableRow = Table1.Rows[0];
    Table1.Rows.Remove(row);

  }

</script>

<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
   <title>HtmlTableRowCollectionExample</title>
</head>
<body>

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

      <h3>HtmlTableRowCollection Example</h3>

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

         <tr>
            <td>
               Cell 1
            </td>
            <td>
               Cell 2
            </td>
         </tr>
         <tr>
            <td>
               Cell 3
            </td>
            <td>
               Cell 4
            </td>
         </tr>

      </table>


      <br /><br />
  
      <input type="button" 
             value="Remove First Row from Table"
             onserverclick="Button_Click" 
             runat="server"/>

   </form>

</body>
</html>

プラットフォーム

Windows 98,Windows Server 2000 SP4,Windows CE,Windows Millennium Edition,Windows Mobile for Pocket PC,Windows Mobile for Smartphone,Windows Server 2003,Windows XP Media Center Edition,Windows XP Professional x64 Edition,Windows XP SP2,Windows XP Starter Edition

Microsoft .NET Framework 3.0 は Windows Vista,Microsoft Windows XP SP2,および Windows Server 2003 SP1 でサポートされています。

バージョン情報

.NET Framework

サポート対象 : 3.0,2.0,1.1,1.0

参照

関連項目

HtmlTableRowCollection クラス
HtmlTableRowCollection メンバ
System.Web.UI.HtmlControls 名前空間
RemoveAt
HtmlTable.Rows プロパティ
HtmlTableRow