DetailsViewRowCollectionとは? わかりやすく解説

DetailsViewRowCollection クラス

メモ : このクラスは、.NET Framework version 2.0新しく追加されたものです。

DetailsView コントロール内の DetailsViewRow オブジェクトコレクション表します

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

Public Class DetailsViewRowCollection
    Implements ICollection, IEnumerable
Dim instance As DetailsViewRowCollection
public class DetailsViewRowCollection : ICollection,
 IEnumerable
public ref class DetailsViewRowCollection :
 ICollection, IEnumerable
public class DetailsViewRowCollection implements
 ICollection, IEnumerable
public class DetailsViewRowCollection implements
 ICollection, IEnumerable
解説解説

DetailsViewRowCollection クラスは、DetailsView コントロール内の DetailsViewRow オブジェクトコレクション格納および管理する場合使用されます。DetailsView コントロール内の各行DetailsViewRow オブジェクト表されます。DetailsView コントロールは、その Rows プロパティに対して DetailsViewRowCollection クラス使用します

メモメモ

Rows プロパティには、データ行だけが格納されます。ヘッダー行、フッター行、上部ページ行、および下部ページ行にアクセスするには、それぞれ HeaderRow、FooterRow、TopPagerRow、および BottomPagerRow の各プロパティ使用します

DetailsViewRowCollection クラスは、コレクション内の項目にアクセスするための複数方法サポートしてます。

コレクション内の合計項目数確認するには、Count プロパティ使用します

使用例使用例

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>
.NET Framework のセキュリティ.NET Frameworkセキュリティ
継承階層継承階層
System.Object
  System.Web.UI.WebControls.DetailsViewRowCollection
スレッド セーフスレッド セーフ
この型の public static (Visual Basic では Shared) メンバはすべて、スレッド セーフです。インスタンス メンバ場合は、スレッド セーフであるとは限りません。
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
DetailsViewRowCollection メンバ
System.Web.UI.WebControls 名前空間
DetailsView クラス
DetailsViewRow クラス
DetailsView.Rows プロパティ
DetailsView.HeaderRow プロパティ
DetailsView.FooterRow プロパティ
DetailsView.TopPagerRow プロパティ
DetailsView.BottomPagerRow プロパティ
Count
Item
CopyTo
GetEnumerator

DetailsViewRowCollection コンストラクタ

メモ : このコンストラクタは、.NET Framework version 2.0新しく追加されたものです。

ArrayList オブジェクト指定して、DetailsViewRowCollection クラス新しインスタンス初期化します。

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

Public Sub New ( _
    rows As ArrayList _
)
Dim rows As ArrayList

Dim instance As New DetailsViewRowCollection(rows)
public DetailsViewRowCollection (
    ArrayList rows
)
public:
DetailsViewRowCollection (
    ArrayList^ rows
)
public DetailsViewRowCollection (
    ArrayList rows
)
public function DetailsViewRowCollection (
    rows : ArrayList
)

パラメータ

rows

コレクション初期化するために使用する DetailsViewRow オブジェクト格納している ArrayList。

解説解説
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
DetailsViewRowCollection クラス
DetailsViewRowCollection メンバ
System.Web.UI.WebControls 名前空間
DetailsView クラス
DetailsViewRow クラス
ArrayList
DetailsView.Rows プロパティ

DetailsViewRowCollection プロパティ


パブリック プロパティパブリック プロパティ

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

関連項目

DetailsViewRowCollection クラス
System.Web.UI.WebControls 名前空間
DetailsView クラス
DetailsViewRow クラス
DetailsView.Rows プロパティ
DetailsView.HeaderRow プロパティ
DetailsView.FooterRow プロパティ
DetailsView.TopPagerRow プロパティ
DetailsView.BottomPagerRow プロパティ
Count
Item
CopyTo
GetEnumerator

DetailsViewRowCollection メソッド


パブリック メソッドパブリック メソッド

プロテクト メソッドプロテクト メソッド
明示的インターフェイスの実装明示的インターフェイス実装
  名前 説明
インターフェイスの明示的な実装 System.Collections.ICollection.CopyTo この DetailsViewRowCollection オブジェクトすべての項目を、指定されArray オブジェクトコピーしますコピー操作は、Array指定されインデックス位置から始まります
参照参照

関連項目

DetailsViewRowCollection クラス
System.Web.UI.WebControls 名前空間
DetailsView クラス
DetailsViewRow クラス
DetailsView.Rows プロパティ
DetailsView.HeaderRow プロパティ
DetailsView.FooterRow プロパティ
DetailsView.TopPagerRow プロパティ
DetailsView.BottomPagerRow プロパティ
Count
Item
CopyTo
GetEnumerator

DetailsViewRowCollection メンバ

DetailsView コントロール内の DetailsViewRow オブジェクトコレクション表します

DetailsViewRowCollection データ型公開されるメンバを以下の表に示します


パブリック コンストラクタパブリック コンストラクタ
  名前 説明
パブリック メソッド DetailsViewRowCollection ArrayList オブジェクト指定して、DetailsViewRowCollection クラス新しインスタンス初期化します。
パブリック プロパティパブリック プロパティ
  名前 説明
パブリック プロパティ Count DetailsViewRowCollection オブジェクト内の項目の数を取得します
パブリック プロパティ IsReadOnly DetailsViewRowCollection オブジェクト内の行を変更できるかどうかを示す値を取得します
パブリック プロパティ IsSynchronized DetailsViewRowCollection オブジェクト同期されている (スレッド セーフである) かどうかを示す値を取得します
パブリック プロパティ Item 指定されインデックス位置にある DetailsViewRow オブジェクトコレクションから取得します
パブリック プロパティ SyncRoot コレクションへのアクセス同期するために使用するオブジェクト取得します
パブリック メソッドパブリック メソッド
プロテクト メソッドプロテクト メソッド
明示的インターフェイスの実装明示的インターフェイス実装
  名前 説明
インターフェイスの明示的な実装 System.Collections.ICollection.CopyTo この DetailsViewRowCollection オブジェクトすべての項目を、指定されArray オブジェクトコピーしますコピー操作は、Array指定されインデックス位置から始まります
参照参照

関連項目

DetailsViewRowCollection クラス
System.Web.UI.WebControls 名前空間
DetailsView クラス
DetailsViewRow クラス
DetailsView.Rows プロパティ
DetailsView.HeaderRow プロパティ
DetailsView.FooterRow プロパティ
DetailsView.TopPagerRow プロパティ
DetailsView.BottomPagerRow プロパティ
Count
Item
CopyTo
GetEnumerator


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

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

辞書ショートカット

すべての辞書の索引

「DetailsViewRowCollection」の関連用語

DetailsViewRowCollectionのお隣キーワード
検索ランキング

   

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



DetailsViewRowCollectionのページの著作権
Weblio 辞書 情報提供元は 参加元一覧 にて確認できます。

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

©2025 GRAS Group, Inc.RSS