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



このメソッドを使用して、指定したインデックス位置にある HtmlTableRow オブジェクトを HtmlTableRowCollection コレクションから削除します。インデックス番号は 0 から始まっています。したがって、コレクションの最初の項目のインデックス値は 0 です。
![]() |
---|

RemoveAt メソッドを使用して、指定したインデックス位置にある項目を HtmlTableRowCollection コレクションから削除する方法を次のコード例に示します。この例では、HtmlTable コントロールの最初の行を削除します。
<%@ Page Language="VB" AutoEventWireup="True" %> <script runat="server"> Sub Button_Click(ByVal sender As Object, ByVal e As EventArgs) ' Remove the first row from the table. Table1.Rows.RemoveAt(0) End Sub </script> <html> <head> <title>HtmlTableRowCollection Example</title> </head> <body> <form runat="server"> <h3>HtmlTableRowCollection 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) { // Remove the first row from the table. Table1.Rows.RemoveAt(0); } </script> <html> <head> <title>HtmlTableRowCollection Example</title> </head> <body> <form runat="server"> <h3>HtmlTableRowCollection 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, e : EventArgs) { // Remove the first row from the table. Table1.Rows.RemoveAt(0); } </script> <html> <head> <title>HtmlTableRowCollection Example</title> </head> <body> <form runat="server"> <h3>HtmlTableRowCollection 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>

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に収録されているすべての辞書からHtmlTableRowCollection.RemoveAt メソッドを検索する場合は、下記のリンクをクリックしてください。

- HtmlTableRowCollection.RemoveAt メソッドのページへのリンク