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

/** @property */ protected boolean get_RequiresDataBinding () /** @property */ protected void set_RequiresDataBinding (boolean value)
protected function get RequiresDataBinding () : boolean protected function set RequiresDataBinding (value : boolean)
データ バインド コントロールの表示前に、そのコントロールの DataBind メソッドを呼び出す必要がある場合は、 true が返されます。それ以外の場合は false が返されます。

データ バインド コントロールがページへの出力の表示を既に開始している場合、その時点の HTTP 要求がコールバックでない場合、バインドするデータ ソース コントロールを DataSourceID プロパティを使用して指定している場合に、RequiresDataBinding プロパティに true を設定すると、DataBind メソッドが直ちに呼び出されます。この場合、実際に RequiresDataBinding プロパティに true が設定されることはありません。

次のコード例では、派生データ バインド コントロール クラスで RequiresDataBinding プロパティを使用する方法を示します。GetData メソッドでデータを取得し、PerformDataBinding メソッドでそのデータをコントロールにバインドした後、RequiresDataBinding プロパティに false を設定し、さらに MarkAsDataBound メソッドを呼び出して、コントロールのバインドが完了していること、および現在のページの有効期間中はこのプロパティが必要ないことを示しています。このコード例は、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); }

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.RequiresDataBinding プロパティを検索する場合は、下記のリンクをクリックしてください。

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