DataBoundControl.GetData メソッドとは? わかりやすく解説

Weblio 辞書 > コンピュータ > .NET Framework クラス ライブラリ リファレンス > DataBoundControl.GetData メソッドの意味・解説 

DataBoundControl.GetData メソッド

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

データ操作を実行するために、データ バインド コントロールが使用する DataSourceView オブジェクトを取得します。

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

Protected Overridable Function
 GetData As DataSourceView
Dim returnValue As DataSourceView

returnValue = Me.GetData
protected virtual DataSourceView GetData ()
protected:
virtual DataSourceView^ GetData ()
protected DataSourceView GetData ()
protected function GetData () : DataSourceView

戻り値
データ操作を実行するためにデータ バインド コントロールが使用する DataSourceView。DataMember プロパティが設定されている場合、特定の、名前付き DataSourceView が返されます。それ以外の場合は、既定の DataSourceView が返されます。

例外例外
例外の種類条件

InvalidOperationException

DataSource プロパティと DataSourceID プロパティの両方が設定されています。

または

DataMember プロパティが設定されていますが、その名前の DataSourceView オブジェクトが存在しません。

解説解説
使用例使用例

GetData メソッドを呼び出して、関連するデータ ソース コントロールから DataSourceView オブジェクトを取得する方法、および Select メソッドを呼び出して、データを取得する方法を次のコード例に示します。このコード例は、DataBoundControl クラスのトピックで取り上げているコード例の一部分です。

Protected Overrides Sub
 PerformSelect()

    ' Call OnDataBinding here if bound to a data source using the 
    ' DataSource property (instead of a DataSourceID) because the 
    ' data-binding statement is evaluated before the call to GetData.
    If Not IsBoundUsingDataSourceID Then
        OnDataBinding(EventArgs.Empty)
    End If

    ' The GetData method retrieves the DataSourceView object from the
 
    ' IDataSource associated with the data-bound control.          
  
    GetData().Select(CreateDataSourceSelectArguments(), _
        AddressOf OnDataSourceViewSelectCallback)

    ' The PerformDataBinding method has completed.
    RequiresDataBinding = False
    MarkAsDataBound()

    ' Raise the DataBound event.
        OnDataBound(EventArgs.Empty)

End Sub 'PerformSelect

protected override void PerformSelect() { 
           

   // Call OnDataBinding here if bound to a data source using the
   // DataSource property (instead of a DataSourceID), because the
   // databinding statement is evaluated before the call to GetData.
       
    if (! IsBoundUsingDataSourceID) {
        OnDataBinding(EventArgs.Empty);
    }            
    
    // The GetData method retrieves the DataSourceView object from 
 
    // the IDataSource associated with the data-bound control.     
       
    GetData().Select(CreateDataSourceSelectArguments(), 
        OnDataSourceViewSelectCallback);
    
    // The PerformDataBinding method has completed.
    RequiresDataBinding = false;
    MarkAsDataBound();
    
    // Raise the DataBound event.
    OnDataBound(EventArgs.Empty);
}
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
DataBoundControl クラス
DataBoundControl メンバ
System.Web.UI.WebControls 名前空間
GetDataSource
DataMember



英和和英テキスト翻訳

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

辞書ショートカット

すべての辞書の索引

DataBoundControl.GetData メソッドのお隣キーワード
検索ランキング

   

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



DataBoundControl.GetData メソッドのページの著作権

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

©2026 GRAS Group, Inc.RSS