BaseDataBoundControl.DataSourceID プロパティ
アセンブリ: System.Web (system.web.dll 内)

Dim instance As BaseDataBoundControl Dim value As String value = instance.DataSourceID instance.DataSourceID = value
[ThemeableAttribute(false)] public: virtual property String^ DataSourceID { String^ get (); void set (String^ value); }
/** @property */ public String get_DataSourceID () /** @property */ public void set_DataSourceID (String value)
データ バインド コントロールのデータの取得元となるデータ ソースを表すコントロールの ID。既定値は String.Empty です。

データ バインド コントロールが既に初期化されている場合 (ConfirmInitState メソッドが呼び出されているか OnPagePreLoad イベントが処理されている場合)、DataSourceID プロパティを設定すると、OnDataPropertyChanged メソッドが呼び出され RequiresDataBinding プロパティに true が設定されます。
このプロパティは、テーマまたはスタイル シート テーマによって設定することはできません。詳細については、ThemeableAttribute、ASP.NET のテーマとスキンの概要 の各トピックを参照してください。

データ バインド コントロールの DataSourceID プロパティの使用方法を、次のコード例に示します。DataSourceID プロパティに SqlDataSource コントロールの ID である "AuthorsSqlDataSource" を設定することで、GridView コントロールを SqlDataSource に関連付けます。(DataSource プロパティの代わりに) DataSourceID プロパティが設定されている場合、データ バインド コントロールは実行時に自動的にデータ ソース コントロールにバインドします。
<%@ Page language="VB" %> <html> <body> <form runat="server"> <h3>GridView Example</h3> <asp:gridview id="CustomersGridView" datasourceid="CustomersSource" autogeneratecolumns="true" emptydatatext="No data available." allowpaging="true" runat="server"> </asp:gridview> <!-- 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="CustomersSource" selectcommand="Select [CustomerID], [CompanyName], [Address], [City], [PostalCode], [Country] From [Customers]" connectionstring="<%$ ConnectionStrings:NorthWindConnectionString%>" runat="server"/> </form> </body> </html>
<%@ Page language="C#" %> <html> <body> <form runat="server"> <h3>GridView Example</h3> <asp:gridview id="CustomersGridView" datasourceid="CustomersSource" autogeneratecolumns="true" emptydatatext="No data available." allowpaging="true" runat="server"> </asp:gridview> <!-- 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="CustomersSource" selectcommand="Select [CustomerID], [CompanyName], [Address], [City], [PostalCode], [Country] From [Customers]" connectionstring="<%$ ConnectionStrings:NorthWindConnectionString%>" runat="server"/> </form> </body> </html>

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


Weblioに収録されているすべての辞書からBaseDataBoundControl.DataSourceID プロパティを検索する場合は、下記のリンクをクリックしてください。

- BaseDataBoundControl.DataSourceID プロパティのページへのリンク