選択したデータ ソースから選択したデータ メンバを取得します。
Function GetResolvedSelectedDataSource() As IEnumerable
[C#]
IEnumerable GetResolvedSelectedDataSource();
[C++]
IEnumerable* GetResolvedSelectedDataSource();
[JScript]
function GetResolvedSelectedDataSource() : IEnumerable;
戻り値
ユーザーがデータ ソース用の IListSource (DataSet など) を選択できるコントロールの場合は、選択されたデータ ソースの選択されたデータ メンバ。このメソッドはまた、データ ソース内で返されるリスト (つまり DataTable) を選択するための DataMember プロパティも提供します。
使用例
[Visual Basic] IDataSourceProvider インターフェイスの GetResolvedSelectedDataSource メソッドと GetSelectedDataSource メソッドを実装するコード例を次に示します。 GetSelectedDataSource メソッドはデータ ソースとして任意のオブジェクトを取得しますが、 GetResolvedSelectedDataSource メソッドのこの実装では、オブジェクトを IEnumerable オブジェクトに変換します。
' Create a method that implements the
' IDataSourceProvider.GetResolvedSelectedDataSource method.
' It converts the object returned from the GetSelectedDataSource
' method into an IEnumberable object to allow iteration over
' the returned object.
Function GetResolvedSelectedDataSource() As IEnumerable _
Implements IDataSourceProvider.GetResolvedSelectedDataSource
Return CType(CType(Me, IDataSourceProvider).GetSelectedDataSource(), IEnumerable)
End Function
' Create a method that implements the
' IDataSourceProvider.GetSelectedDataSource method.
' Return the data source as an IEnumerable object,
' if possible.
Function GetSelectedDataSource() As Object _
Implements IDataSourceProvider.GetSelectedDataSource
Dim selectedDataSource As Object = Nothing
Dim dataSource As String = Nothing
Dim binding As DataBinding = DataBindings("DataSource")
If Not (binding Is Nothing) Then
dataSource = binding.Expression
End If
If Not (dataSource Is Nothing) Then
Dim componentSite As ISite = Component.Site
If Not (componentSite Is Nothing) Then
Dim container As IContainer = CType(componentSite.GetService(GetType(IContainer)), IContainer)
If Not (container Is Nothing) Then
Dim comp As IComponent = container.Components(dataSource)
If TypeOf comp Is IEnumerable Then
selectedDataSource = comp
End If
End If
End If
End If
Return selectedDataSource
End Function
[C#, C++, JScript] C#、C++、および JScript のサンプルはありません。Visual Basic のサンプルを表示するには、このページの左上隅にある言語のフィルタ ボタン をクリックします。
必要条件
プラットフォーム: Windows 2000, Windows XP Professional, Windows Server 2003 ファミリ
.NET Framework セキュリティ:
- 直前の呼び出し元の完全信頼。このメンバは、部分的に信頼されているコードから使用することはできません。詳細の参照先 : 部分信頼コードからのライブラリの使用
参照
IDataSourceProvider インターフェイス | IDataSourceProvider メンバ | System.Web.UI.Design 名前空間