GridViewRowCollection クラス
アセンブリ: System.Web (system.web.dll 内)


GridViewRowCollection クラスは、GridView コントロール内の GridViewRow オブジェクトのコレクションを格納および管理する場合に使用されます。GridView コントロール内の各行は、GridViewRow オブジェクトによって表されます。GridView コントロールは、すべてのデータ行を Rows コレクションに格納します。
GridViewRowCollection クラスは、コレクション内の項目にアクセスするための複数の方法をサポートしています。

GridView コントロールの Rows コレクションを反復処理して、ページの列の値を表示する方法を次の例に示します。
<%@ Page language="VB" %> <script runat="server"> Sub AuthorsGridView_RowCreated(ByVal sender As Object, ByVal e As GridViewRowEventArgs) If e.Row.RowType = DataControlRowType.Footer Then ' Get the number of items in the Rows collection. Dim count As Integer = AuthorsGridView.Rows.Count ' If the GridView control contains any records, display ' the last name of each author in the GridView control. If count > 0 Then Message.Text = "The authors are:<br>" Dim row As GridViewRow For Each row In AuthorsGridView.Rows Message.Text &= row.Cells(0).Text & "<br>" Next End If End If End Sub </script> <html> <body> <form runat="server"> <h3>GridViewRowCollection Example</h3> <table> <tr> <td> <asp:gridview id="AuthorsGridView" datasourceid="AuthorsSqlDataSource" autogeneratecolumns="false" onrowcreated="AuthorsGridView_RowCreated" runat="server"> <columns> <asp:boundfield datafield="au_lname" headertext="Last Name"/> <asp:boundfield datafield="au_fname" headertext="First Name"/> </columns> </asp:gridview> </td> <td> <asp:label id="Message" forecolor="Red" runat="server"/> </td> </tr> </table> <!-- This example uses Microsoft SQL Server and connects --> <!-- to the Pubs sample database. --> <asp:sqldatasource id="AuthorsSqlDataSource" selectcommand="SELECT [au_lname], [au_fname] FROM [authors] WHERE [state]='CA'" connectionstring="server=localhost;database=pubs;integrated security=SSPI" runat="server"> </asp:sqldatasource> </form> </body> </html>
<%@ Page language="C#" %> <script runat="server"> void AuthorsGridView_RowCreated(Object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.Footer) { // Get the number of items in the Rows collection. int count = AuthorsGridView.Rows.Count; // If the GridView control contains any records, display // the last name of each author in the GridView control. if (count > 0) { Message.Text = "The authors are:<br>"; foreach (GridViewRow row in AuthorsGridView.Rows) { Message.Text += row.Cells[0].Text + "<br>"; } } } } </script> <html> <body> <form runat="server"> <h3>GridViewRowCollection Example</h3> <table> <tr> <td> <asp:gridview id="AuthorsGridView" datasourceid="AuthorsSqlDataSource" autogeneratecolumns="false" onrowcreated="AuthorsGridView_RowCreated" runat="server"> <columns> <asp:boundfield datafield="au_lname" headertext="Last Name"/> <asp:boundfield datafield="au_fname" headertext="First Name"/> </columns> </asp:gridview> </td> <td> <asp:label id="Message" forecolor="Red" runat="server"/> </td> </tr> </table> <!-- This example uses Microsoft SQL Server and connects --> <!-- to the Pubs sample database. --> <asp:sqldatasource id="AuthorsSqlDataSource" selectcommand="SELECT [au_lname], [au_fname] FROM [authors] WHERE [state]='CA'" connectionstring="server=localhost;database=pubs;integrated security=SSPI" runat="server"> </asp:sqldatasource> </form> </body> </html>


System.Web.UI.WebControls.GridViewRowCollection


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 によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


GridViewRowCollection コンストラクタ
アセンブリ: System.Web (system.web.dll 内)


このコンストラクタは、指定した System.Collections.ArrayList オブジェクトを使用して GridViewRowCollection クラスの新しいインスタンスを初期化するために使用します。System.Collections.ArrayList オブジェクトには、コレクションに項目を挿入するために使用する GridViewRow オブジェクトが保持されています。

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 によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


GridViewRowCollection プロパティ

名前 | 説明 | |
---|---|---|
![]() | Count | GridViewRowCollection オブジェクト内の項目の数を取得します。 |
![]() | IsReadOnly | GridViewRowCollection オブジェクト内の行を変更できるかどうかを示す値を取得します。 |
![]() | IsSynchronized | GridViewRowCollection オブジェクトが同期されている (スレッド セーフである) かどうかを示す値を取得します。 |
![]() | Item | 指定したインデックス位置にある GridViewRow オブジェクトを取得します。 |
![]() | SyncRoot | コレクションへのアクセスを同期するために使用するオブジェクトを取得します。 |

GridViewRowCollection メソッド

名前 | 説明 | |
---|---|---|
![]() | CopyTo | 指定した System.Array オブジェクトに GridViewRowCollection のすべての項目をコピーします。コピー操作は、System.Array オブジェクトの指定したインデックス位置から始まります。 |
![]() | Equals | オーバーロードされます。 2 つの Object インスタンスが等しいかどうかを判断します。 ( Object から継承されます。) |
![]() | GetEnumerator | GridViewRowCollection 内のすべての GridViewRow オブジェクトを格納している列挙子を返します。 |
![]() | GetHashCode | 特定の型のハッシュ関数として機能します。GetHashCode は、ハッシュ アルゴリズムや、ハッシュ テーブルのようなデータ構造での使用に適しています。 ( Object から継承されます。) |
![]() | GetType | 現在のインスタンスの Type を取得します。 ( Object から継承されます。) |
![]() | ReferenceEquals | 指定した複数の Object インスタンスが同一かどうかを判断します。 ( Object から継承されます。) |
![]() | ToString | 現在の Object を表す String を返します。 ( Object から継承されます。) |

名前 | 説明 | |
---|---|---|
![]() | Finalize | Object がガベージ コレクションにより収集される前に、その Object がリソースを解放し、その他のクリーンアップ操作を実行できるようにします。 ( Object から継承されます。) |
![]() | MemberwiseClone | 現在の Object の簡易コピーを作成します。 ( Object から継承されます。) |


GridViewRowCollection メンバ
GridView コントロール内の GridViewRow オブジェクトのコレクションを表します。
GridViewRowCollection データ型で公開されるメンバを以下の表に示します。

名前 | 説明 | |
---|---|---|
![]() | GridViewRowCollection | System.Collections.ArrayList オブジェクトを指定して、GridViewRowCollection クラスの新しいインスタンスを初期化します。 |

名前 | 説明 | |
---|---|---|
![]() | Count | GridViewRowCollection オブジェクト内の項目の数を取得します。 |
![]() | IsReadOnly | GridViewRowCollection オブジェクト内の行を変更できるかどうかを示す値を取得します。 |
![]() | IsSynchronized | GridViewRowCollection オブジェクトが同期されている (スレッド セーフである) かどうかを示す値を取得します。 |
![]() | Item | 指定したインデックス位置にある GridViewRow オブジェクトを取得します。 |
![]() | SyncRoot | コレクションへのアクセスを同期するために使用するオブジェクトを取得します。 |

名前 | 説明 | |
---|---|---|
![]() | CopyTo | 指定した System.Array オブジェクトに GridViewRowCollection のすべての項目をコピーします。コピー操作は、System.Array オブジェクトの指定したインデックス位置から始まります。 |
![]() | Equals | オーバーロードされます。 2 つの Object インスタンスが等しいかどうかを判断します。 (Object から継承されます。) |
![]() | GetEnumerator | GridViewRowCollection 内のすべての GridViewRow オブジェクトを格納している列挙子を返します。 |
![]() | GetHashCode | 特定の型のハッシュ関数として機能します。GetHashCode は、ハッシュ アルゴリズムや、ハッシュ テーブルのようなデータ構造での使用に適しています。 (Object から継承されます。) |
![]() | GetType | 現在のインスタンスの Type を取得します。 (Object から継承されます。) |
![]() | ReferenceEquals | 指定した複数の Object インスタンスが同一かどうかを判断します。 (Object から継承されます。) |
![]() | ToString | 現在の Object を表す String を返します。 (Object から継承されます。) |

名前 | 説明 | |
---|---|---|
![]() | Finalize | Object がガベージ コレクションにより収集される前に、その Object がリソースを解放し、その他のクリーンアップ操作を実行できるようにします。 (Object から継承されます。) |
![]() | MemberwiseClone | 現在の Object の簡易コピーを作成します。 (Object から継承されます。) |


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

- GridViewRowCollectionのページへのリンク