コントロールのデータ ソース プロパティを取得または設定します。
Public Property DataSource As String
[C#]
public string DataSource {get; set;}
[C++]
public: __property String* get_DataSource();public: __property void set_DataSource(String*);
[JScript]
public function get DataSource() : String;public function set DataSource(String);
プロパティ値
リスト コントロールの DataSource プロパティ。
使用例
[Visual Basic] GetDesignTimeHtml メソッドをオーバーライドする例を次に示します。このコードは、 try/catch/finally ブロックの try セクションで、 changedDataSource
という名前の Boolean 変数の値をチェックします。値が true の場合は、コントロールの ListItemCollection クラスに項目を追加し、デザイナに表示されるようにします。この項目には、 DataSource プロパティの値が含まれます。この項目は、 finally セクションでコレクションから削除されます。
[Visual Basic] このコード例は、 ListControlDesigner クラスのトピックで取り上げているコード例の一部分です。
' Create HTML to display the control
' on the design surface.
Overrides Public Function GetDesignTimeHtml() As String
Dim designTimeHtml As String
' Create variables to access the control's
' item collection and back color.
Dim items As ListItemCollection = simpleRadioButtonList.Items
Dim oldBackColor As Color = simpleRadioButtonList.BackColor
' Check property values and render HTML
' on the design surface accordingly.
Try
If (Color.op_Equality(oldBackColor, Color.Empty)) Then
simpleRadioButtonList.BackColor = Color.Gainsboro
End If
If (changedDataSource) Then
items.Add( _
"Updated to new data source: " & DataSource ".")
End If
designTimeHtml = MyBase.GetDesignTimeHtml()
' Catch any exceptions that occur.
Catch ex As Exception
MyBase.GetErrorDesignTimeHtml(ex)
' Set the properties to original state.
Finally
simpleRadioButtonList.BackColor = oldBackColor
items.Clear()
End Try
Return designTimeHtml
End Function
[C#, C++, JScript] C#、C++、および JScript のサンプルはありません。Visual Basic のサンプルを表示するには、このページの左上隅にある言語のフィルタ ボタン をクリックします。
必要条件
プラットフォーム: Windows 2000, Windows XP Professional, Windows Server 2003 ファミリ
.NET Framework セキュリティ:
- 直前の呼び出し元の完全信頼。このメンバは、部分的に信頼されているコードから使用することはできません。詳細の参照先 : 部分信頼コードからのライブラリの使用
参照
ListControlDesigner クラス | ListControlDesigner メンバ | System.Web.UI.Design.WebControls 名前空間