HtmlTableCellCollection.Remove メソッド
アセンブリ: System.Web (system.web.dll 内)


このメソッドを使用して、指定した HtmlTableCell オブジェクトを HtmlTableCellCollection コレクションから削除します。
![]() |
---|
HtmlTableCellCollection コレクションに存在しない HtmlTableCell オブジェクトを指定した場合、項目はコレクションから削除されません。 |

Remove メソッドを使用して、HtmlTableCellCollection コレクションから HtmlTableCell オブジェクトが表すテーブルの指定したセルを削除する方法を次のコード例に示します。この例では HtmlTable コントロールの最初の列からセルを削除します。
<%@ Page Language="VB" AutoEventWireup="True" %> <script runat="server"> Sub Button_Click(ByVal sender As Object, ByVal e As EventArgs) Dim i As Integer Dim cell As HtmlTableCell ' Iterate through the rows of the table. For i = 0 To Table1.Rows.Count - 1 ' Remove the cells from the first column. cell = Table1.Rows(i).Cells(0) Table1.Rows(i).Cells.Remove(cell) Next i 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 Column 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) { // Iterate through the rows of the table. for (int i = 0; i <= Table1.Rows.Count - 1; i++) { // Remove the cells from the first column. HtmlTableCell cell = Table1.Rows[i].Cells[0]; Table1.Rows[i].Cells.Remove(cell); } } </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 Column 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) { // Iterate through the rows of the table. for (var i : int = 0; i <= Table1.Rows.Count - 1; i++) { // Remove the cells from the first column. var cell : HtmlTableCell = Table1.Rows[i].Cells[0]; Table1.Rows[i].Cells.Remove(cell); } } </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 Column from Table" onserverclick="Button_Click" runat="server"/> </form> </body> </html>

Windows 98, Windows 2000 SP4, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


Weblioに収録されているすべての辞書からHtmlTableCellCollection.Remove メソッドを検索する場合は、下記のリンクをクリックしてください。

- HtmlTableCellCollection.Remove メソッドのページへのリンク