HtmlTableCellCollection.Clear メソッドとは? わかりやすく解説

Weblio 辞書 > コンピュータ > .NET Framework クラス ライブラリ リファレンス > HtmlTableCellCollection.Clear メソッドの意味・解説 

HtmlTableCellCollection.Clear メソッド

HtmlTableCellCollection コレクションからすべての HtmlTableCell オブジェクト削除します

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

解説解説

このメソッド使用してHtmlTableCellCollection コレクションからすべての HtmlTableCell オブジェクト削除しCount プロパティ0リセットします。

メモメモ

このメソッドは行からセル削除しますが、テーブルら行削除することはありません。テーブルら行削除するには、HtmlTable コントロールRows コレクションから、行を表す HtmlTableRow オブジェクト削除してください

使用例使用例

Clear メソッド使用してHtmlTableCellCollection コレクションからすべての項目を削除する方法次のコード例示しますその後新しいエントリがコレクション追加されHtmlTable コントロール表示されます。

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

<script runat="server">
  
  Sub Button_Click(ByVal sender As
 Object, ByVal e As EventArgs)
 
    ' Clear the cells from the first row and remove the 
    ' row from the table.
    Table1.Rows(0).Cells.Clear()
    Table1.Rows.RemoveAt(0)

  End Sub

</script>

<html>
<head>
   <title>HtmlTableCellCollection Example</title>
</head>
<body>

   <form runat="server">

      <h3>HtmlTableCellCollection Example</h3>

      <table id="Table1" 
             border="1" 
             bordercolor="black" 
             runat="server">

         <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" %>

<script runat="server">

  void Button_Click(Object sender, EventArgs e)
  {

    // Clear the cells from the first row and remove the 
    // row from the table.
    Table1.Rows[0].Cells.Clear();
    Table1.Rows.RemoveAt(0);

  }

</script>

<html>
<head>
   <title>HtmlTableCellCollection Example</title>
</head>
<body>

   <form runat="server">

      <h3>HtmlTableCellCollection Example</h3>

      <table id="Table1" 
             border="1" 
             bordercolor="black" 
             runat="server">

         <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" %>

<script runat="server">

  function Button_Click(sender : Object, e : EventArgs) 
  {
 
     // Clear the cells from the first row and remove the 
     // row from the table.
     Table1.Rows[0].Cells.Clear();
     Table1.Rows.RemoveAt(0);

  }

</script>

<html>
<head>


</head>
<body>

   <form runat="server">

      <h3>HtmlTableCellCollection Example</h3>

      <table id="Table1" 
             border="1" 
             bordercolor="black" 
             runat="server">

         <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>
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
HtmlTableCellCollection クラス
HtmlTableCellCollection メンバ
System.Web.UI.HtmlControls 名前空間
HtmlTableCell クラス
HtmlTableRow
Cells
Count


このページでは「.NET Framework クラス ライブラリ リファレンス」からHtmlTableCellCollection.Clear メソッドを検索した結果を表示しています。
Weblioに収録されているすべての辞書からHtmlTableCellCollection.Clear メソッドを検索する場合は、下記のリンクをクリックしてください。
 全ての辞書からHtmlTableCellCollection.Clear メソッド を検索

英和和英テキスト翻訳>> Weblio翻訳
英語⇒日本語日本語⇒英語
  

辞書ショートカット

すべての辞書の索引

HtmlTableCellCollection.Clear メソッドのお隣キーワード
検索ランキング

   

英語⇒日本語
日本語⇒英語
   



HtmlTableCellCollection.Clear メソッドのページの著作権
Weblio 辞書 情報提供元は 参加元一覧 にて確認できます。

   
日本マイクロソフト株式会社日本マイクロソフト株式会社
© 2025 Microsoft.All rights reserved.

©2025 GRAS Group, Inc.RSS