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

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

Repeater.DataSourceID プロパティ

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

Repeater コントロールデータ ソース取得使用する必要があるデータ ソース コントロールID プロパティ取得または設定します

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

Public Overridable Property
 DataSourceID As String
Dim instance As Repeater
Dim value As String

value = instance.DataSourceID

instance.DataSourceID = value
public virtual string DataSourceID { get;
 set; }
/** @property */
public String get_DataSourceID ()

/** @property */
public void set_DataSourceID (String value)
public function get DataSourceID
 () : String

public function set DataSourceID
 (value : String)

プロパティ
データ ソース コントロールID プロパティ

例外例外
例外種類条件

HttpException

次の理由によりデータ ソース解決できません。

解説解説

DataSourceID プロパティ使用してRepeater コントロールデータ ソース取得使用する必要があるデータ ソース コントロールID プロパティアクセスます。IDataSource インターフェイス実装する任意のコントロールを、DataSourceID プロパティによって参照されるデータ ソース コントロールできますデータ ソース コントロールは、これを参照する Repeater コントロールと同じ名前付けコンテナか、Repeater コントロールの親コントロール存在する必要がありますDataSourceID プロパティの値を指定すると、Repeater コントロールは、指定したデータ ソース コントロールバインドされます。DataBind メソッド明示的に呼び出すコード記述する要はありません。

また、DataSource プロパティ使用してRepeater コントロールバインドする値のソース指定できますデータ ソースは、System.Collections.IEnumerable インターフェイス (System.Data.DataView、System.Collections.ArrayList、System.Collections.Hashtable のいずれかオブジェクトなど) または IListSource インターフェイス実装するオブジェクトである必要がありますDataSource プロパティ設定する場合は、データ バインディング実行するコード記述する必要があります

DataSource プロパティDataSourceID プロパティ両方に値を指定した場合ASP.NETデータ ソース解決できず、System.Web.HttpException 例外スローさます。

このプロパティの値はビューステート格納されます。

使用例使用例

DataSourceID プロパティを SqlDataSource コントロールID プロパティ設定する方法次のコード例示しますページ読み込まれると、Repeater コントロールは、SqlDataSource コントロールによって指定されデータ ソースバインドされ、ユーザーデータ表示されます。

<%@ Page Language="VB" %>

<html>
  <head>
  </head>

  <body>
    <form id="Form1" runat="server">
        
      <h3>Repeater.DataSourceID Property Example</h3>
      
      <asp:repeater id=Repeater1       
        datasourceid="SqlDataSource1"
        runat=Server>
        
        <headertemplate>
          <table border=1>
            <tr>
              <td><b>Product ID</b></td>
              <td><b>Product Name</b></td>
            </tr>
        </headertemplate>
          
        <itemtemplate>
          <tr>
            <td> <%# Eval("ProductID") %>
 </td>
            <td> <%# Eval("ProductName")
 %> </td>
          </tr>
        </itemtemplate>
          
        <footertemplate>
          </table>
        </footertemplate>
      </asp:repeater>
        
            <asp:sqldatasource id="SqlDataSource1"
          
            connectionstring="<%$ ConnectionStrings:NorthWindConnection%>"
 
        selectcommand="SELECT ProductID, ProductName FROM [Products]
 Where ProductID <= 10"
        runat="server">
      </asp:sqldatasource>
               
    </form>      
  </body>
</html>
<%@ page language="C#" %>

<html>
  <head>
  </head>

  <body>
    <form id="Form1" runat="server">
        
      <h3>Repeater.DataSourceID Property Example</h3>
      
      <asp:repeater id=Repeater1       
        datasourceid="SqlDataSource1"
        runat=Server>
        
        <headertemplate>
          <table border=1>
            <tr>
              <td><b>Product ID</b></td>
              <td><b>Product Name</b></td>
            </tr>
        </headertemplate>
          
        <itemtemplate>
          <tr>
            <td> <%# Eval("ProductID") %> </td>
            <td> <%# Eval("ProductName") %> </td>
          </tr>
        </itemtemplate>
          
        <footertemplate>
          </table>
        </footertemplate>
      </asp:repeater>
        
            <asp:sqldatasource id="SqlDataSource1"          
            connectionstring="<%$ ConnectionStrings:NorthWindConnection%>"
 
        selectcommand="SELECT ProductID, ProductName FROM [Products] Where ProductID
 <= 10"
        runat="server">
      </asp:sqldatasource>
               
    </form>      
  </body>
</html>
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照


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

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

辞書ショートカット

すべての辞書の索引

「Repeater.DataSourceID プロパティ」の関連用語

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

   

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



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

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

©2024 GRAS Group, Inc.RSS