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

/** @property */ protected boolean get_ChildControlsCreated () /** @property */ protected void set_ChildControlsCreated (boolean value)
protected function get ChildControlsCreated () : boolean protected function set ChildControlsCreated (value : boolean)
子コントロールが作成された場合は true。それ以外の場合は false。

OnDataBinding メソッドのオーバーライドの例を次に示します。再びデータ連結が発生するまで子コントロールが作成されないようにするために、RepeaterItem オブジェクトを作成し、コントロールの ControlCollection オブジェクトに追加すると、ChildControlsCreated プロパティは true に設定されます。
' Override to create the repeated items from the DataSource. Protected Overrides Sub OnDataBinding(E As EventArgs) MyBase.OnDataBinding(e) If Not DataSource Is Nothing ' Clear any existing child controls. Controls.Clear() ' Clear any previous view state for the existing child controls. ClearChildViewState() ' Iterate over the DataSource, creating a new item for each data item. Dim DataEnum As IEnumerator = DataSource.GetEnumerator() Dim I As Integer = 0 Do While (DataEnum.MoveNext()) ' Create an item. Dim Item As RepeaterItemVB = New RepeaterItemVB(I, DataEnum.Current) ' Initialize the item from the template. ItemTemplate.InstantiateIn(Item) ' Add the item to the ControlCollection. Controls.Add(Item) I = I + 1 Loop ' Prevent child controls from being created again. ChildControlsCreated = true ' Store the number of items created in view state for postback scenarios. ViewState("NumItems") = I End If End Sub
// Override to create the repeated items from the DataSource. protected override void OnDataBinding(EventArgs e) { base.OnDataBinding(e); if (DataSource != null) { // Clear any existing child controls. Controls.Clear(); // Clear any previous view state for the existing child controls. ClearChildViewState(); // Iterate over the DataSource, creating a new item for each data item. IEnumerator dataEnum = DataSource.GetEnumerator(); int i = 0; while(dataEnum.MoveNext()) { // Create an item. RepeaterItem item = new RepeaterItem(i, dataEnum.Current); // Initialize the item from the template. ItemTemplate.InstantiateIn(item); // Add the item to the ControlCollection. Controls.Add(item); i++; } // Prevent child controls from being created again. ChildControlsCreated = true; // Store the number of items created in view state for postback scenarios. ViewState["NumItems"] = i; } }
// Override to create the repeated items from the DataSource. protected void OnDataBinding(EventArgs e) { super.OnDataBinding(e); if (get_DataSource() != null) { // Clear any existing child controls. get_Controls().Clear(); // Clear any previous view state for the existing child controls. ClearChildViewState(); // Iterate over the DataSource, creating a new item for each // data item. IEnumerator dataEnum = get_DataSource().GetEnumerator(); int i = 0; while (dataEnum.MoveNext()) { // Create an item. RepeaterItem item = new RepeaterItem(i, dataEnum.get_Current()); // Initialize the item from the template. get_ItemTemplate().InstantiateIn(item); // Add the item to the ControlCollection. get_Controls().Add(item); i++; } // Prevent child controls from being created again. set_ChildControlsCreated(true); // Store the number of items created in view state for postback // scenarios. get_ViewState().set_Item("NumItems", (Int32)i); } } //OnDataBinding

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に収録されているすべての辞書からControl.ChildControlsCreated プロパティを検索する場合は、下記のリンクをクリックしてください。

- Control.ChildControlsCreated プロパティのページへのリンク