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


DetailsViewRowCollection クラスは、DetailsView コントロール内の DetailsViewRow オブジェクトのコレクションを格納および管理する場合に使用されます。DetailsView コントロール内の各行は DetailsViewRow オブジェクトで表されます。DetailsView コントロールは、その Rows プロパティに対して DetailsViewRowCollection クラスを使用します。
![]() |
---|
Rows プロパティには、データ行だけが格納されます。ヘッダー行、フッター行、上部のページ行、および下部のページ行にアクセスするには、それぞれ HeaderRow、FooterRow、TopPagerRow、および BottomPagerRow の各プロパティを使用します。 |
DetailsViewRowCollection クラスは、コレクション内の項目にアクセスするための複数の方法をサポートしています。

DetailsView コントロールの Rows コレクション内の DetailsViewRow オブジェクトを反復処理する方法のコード例を次に示します。このコード例では、各行の値がページに表示されます。
<%@ page language="VB" %> <script runat="server"> Sub SubmitButton_Click(ByVal sender As Object, ByVal e As EventArgs) ' Use the Count property to determine whether the ' Rows collection contains any item. If ItemDetailsView.Rows.Count > 0 Then ' Iterate through the Rows collection and display ' the value of each field. MessageLabel.Text = "The row values are: <br/><br/>" Dim row As DetailsViewRow For Each row In ItemDetailsView.Rows ' Use the Text property to access the value of ' each cell. In this example, the cells in the ' first column (index 0) contains the field names, ' while the cells in the second column (index 1) ' contains the field value. MessageLabel.Text &= row.Cells(0).Text & " = " & _ row.Cells(1).Text & "<br/>" Next Else MessageLabel.Text = "No items." End If End Sub </script> <html> <body> <form runat="server"> <h3>DetailsViewRowCollection Example</h3> <asp:detailsview id="ItemDetailsView" datasourceid="DetailsViewSource" allowpaging="true" autogeneraterows="false" runat="server"> <fields> <asp:boundfield datafield="CustomerID" headertext="Customer ID"/> <asp:boundfield datafield="CompanyName" headertext="Company Name"/> <asp:boundfield datafield="Address" headertext="Address"/> <asp:boundfield datafield="City" headertext="City"/> <asp:boundfield datafield="PostalCode" headertext="ZIP Code"/> <asp:boundfield datafield="Country" headertext="Country"/> </fields> </asp:detailsview> <br/> <asp:button id="SubmitButton" text="Display Row Values" onclick="SubmitButton_Click" runat="server"/> <br/><br/> <asp:label id="MessageLabel" forecolor="Red" runat="server"/> <!-- This example uses Microsoft SQL Server and connects --> <!-- to the Northwind sample database. Use an ASP.NET --> <!-- expression to retrieve the connection string value --> <!-- from the web.config file. --> <asp:sqldatasource id="DetailsViewSource" selectcommand="Select [CustomerID], [CompanyName], [Address], [City], [PostalCode], [Country] From [Customers]" connectionstring= "<%$ ConnectionStrings:NorthWindConnectionString%>" runat="server"/> </form> </body> </html>
<%@ page language="C#" %> <script runat="server"> void SubmitButton_Click(Object sender, EventArgs e) { // Use the Count property to determine whether the // Rows collection contains any item. if (ItemDetailsView.Rows.Count > 0) { // Iterate through the Rows collection and display // the value of each field. MessageLabel.Text = "The row values are: <br/><br/>"; foreach (DetailsViewRow row in ItemDetailsView.Rows) { // Use the Text property to access the value of // each cell. In this example, the cells in the // first column (index 0) contains the field names, // while the cells in the second column (index 1) // contains the field value. MessageLabel.Text += row.Cells[0].Text + " = " + row.Cells[1].Text + "<br/>"; } } else { MessageLabel.Text = "No items."; } } </script> <html> <body> <form runat="server"> <h3>DetailsViewRowCollection Example</h3> <asp:detailsview id="ItemDetailsView" datasourceid="DetailsViewSource" allowpaging="true" autogeneraterows="false" runat="server"> <fields> <asp:boundfield datafield="CustomerID" headertext="Customer ID"/> <asp:boundfield datafield="CompanyName" headertext="Company Name"/> <asp:boundfield datafield="Address" headertext="Address"/> <asp:boundfield datafield="City" headertext="City"/> <asp:boundfield datafield="PostalCode" headertext="ZIP Code"/> <asp:boundfield datafield="Country" headertext="Country"/> </fields> </asp:detailsview> <br/> <asp:button id="SubmitButton" text="Display Row Values" onclick="SubmitButton_Click" runat="server"/> <br/><br/> <asp:label id="MessageLabel" forecolor="Red" runat="server"/> <!-- This example uses Microsoft SQL Server and connects --> <!-- to the Northwind sample database. Use an ASP.NET --> <!-- expression to retrieve the connection string value --> <!-- from the web.config file. --> <asp:sqldatasource id="DetailsViewSource" selectcommand="Select [CustomerID], [CompanyName], [Address], [City], [PostalCode], [Country] From [Customers]" connectionstring= "<%$ ConnectionStrings:NorthWindConnectionString%>" runat="server"/> </form> </body> </html>


System.Web.UI.WebControls.DetailsViewRowCollection


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


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


指定した ArrayList オブジェクトを使用して DetailsViewRowCollection クラスの新しいインスタンスを初期化するには、このコンストラクタを使用します。コレクションを作成するために使用するDetailsViewRow オブジェクトを格納している ArrayList オブジェクト。

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


DetailsViewRowCollection プロパティ

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

DetailsViewRowCollection メソッド

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

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

名前 | 説明 | |
---|---|---|
![]() | System.Collections.ICollection.CopyTo | この DetailsViewRowCollection オブジェクトのすべての項目を、指定された Array オブジェクトにコピーします。コピー操作は、Array の指定されたインデックス位置から始まります。 |

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


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

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

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

名前 | 説明 | |
---|---|---|
![]() | System.Collections.ICollection.CopyTo | この DetailsViewRowCollection オブジェクトのすべての項目を、指定された Array オブジェクトにコピーします。コピー操作は、Array の指定されたインデックス位置から始まります。 |

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

- DetailsViewRowCollectionのページへのリンク