DetailsViewRowCollection.Item プロパティとは? わかりやすく解説

Weblio 辞書 > コンピュータ > .NET Framework クラス ライブラリ リファレンス > DetailsViewRowCollection.Item プロパティの意味・解説 

DetailsViewRowCollection.Item プロパティ

メモ : このプロパティは、.NET Framework version 2.0新しく追加されたものです。

指定されインデックス位置にある DetailsViewRow オブジェクトコレクションから取得します

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

Dim instance As DetailsViewRowCollection
Dim index As Integer
Dim value As DetailsViewRow

value = instance(index)
public DetailsViewRow this [
    int index
] { get; }
public:
property DetailsViewRow^ default [int] {
    DetailsViewRow^ get (int index);
}
/** @property */
public DetailsViewRow get_Item (int index)

パラメータ

index

コレクションから取得する DetailsViewRow のインデックス

プロパティ
コレクション内の指定されインデックス位置にある DetailsViewRow

解説解説
使用例使用例

インデクサ使用して特定のインデックス位置にある 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
    
      ' Display the field value in the first data row.
     
      ' Use the indexer to get the first data row 
      ' (index 0) from the Rows collection.
      Dim row As DetailsViewRow = ItemDetailsView.Rows(0)

      MessageLabel.Text = "The field value for the first row is:
 <br/><br/>"

      ' 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."
    
    End If

  End Sub
  
</script>

<html>
  <body>
    <form runat="server">
    
      <h3>DetailsViewRowCollection Indexer 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 Value"
        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)
    {
      // Display the field value in the first data row.
     
      // Use the indexer to get the first data row 
      // (index 0) from the Rows collection.
      DetailsViewRow row = ItemDetailsView.Rows[0];

      MessageLabel.Text = "The field value for the first
 row is: <br/><br/>";

      // 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 Indexer 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 Value"
        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>
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
DetailsViewRowCollection クラス
DetailsViewRowCollection メンバ
System.Web.UI.WebControls 名前空間
DetailsView クラス
DetailsViewRow クラス
DetailsView.Rows プロパティ
CopyTo
GetEnumerator


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

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

辞書ショートカット

すべての辞書の索引

DetailsViewRowCollection.Item プロパティのお隣キーワード
検索ランキング

   

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



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

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

©2025 GRAS Group, Inc.RSS