DataPager.FindPageableItemContainer DataPager.FindPageableItemContainer DataPager.FindPageableItemContainer DataPager.FindPageableItemContainer Method

定義

擷取與 DataPager 控制項關聯的資料繫結控制項。Retrieves the data-bound control that is associated with the DataPager control.

protected:
 virtual System::Web::UI::WebControls::IPageableItemContainer ^ FindPageableItemContainer();
protected virtual System.Web.UI.WebControls.IPageableItemContainer FindPageableItemContainer ();
abstract member FindPageableItemContainer : unit -> System.Web.UI.WebControls.IPageableItemContainer
override this.FindPageableItemContainer : unit -> System.Web.UI.WebControls.IPageableItemContainer
Protected Overridable Function FindPageableItemContainer () As IPageableItemContainer

傳回

DataPager 控制項關聯的資料繫結控制項。The data-bound control that is associated with the DataPager control.

例外狀況

在頁面上找不到實作 IPageableItemContainer 介面的控制項。A control that implements the IPageableItemContainer interface was not found on the page.

-或--or- PagedControlID 屬性 (Property) 指定的控制項沒有實作 IPageableItemContainer 介面。The control specified by the PagedControlID property does not implement the IPageableItemContainer interface.

-或--or- DataPager 控制項沒有命名容器。The DataPager control does not have a naming container.

備註

這個方法所抓取的資料繫結控制項會參考包含DataPager控制項頁面之資料的資料來源物件。The data-bound control retrieved by this method references a data source object that contains the data that the DataPager control pages. 為了讓IPageableItemContainer控制項能夠分頁此資料, 資料繫結控制項必須執行介面。 DataPagerFor the DataPager control to be able to page this data, the data-bound control must implement the IPageableItemContainer interface.

方法會檢查PagedControlID屬性是否設定為資料繫結控制項的識別碼。 FindPageableItemContainerThe FindPageableItemContainer method checks whether the PagedControlID property is set to the ID of a data-bound control. 如果未設定FindPageableItemContainer屬性,方法會將命名容器的堆疊放在一起來尋找資料繫結控制項。 PagedControlIDIf the PagedControlID property is not set, the FindPageableItemContainer method goes up the stack of naming containers to look for a data-bound control. 例如, 如果DataPager控制項ListView位於控制項的ListView.LayoutTemplate範本內, 則PagedControlID不需要設定屬性。For example, if the DataPager control is inside the ListView.LayoutTemplate template of a ListView control, the PagedControlID property does not have to be set. 這是因為FindPageableItemContainer方法可以藉由檢查控制項ListView樹狀結構來自動尋找控制項。This is because the FindPageableItemContainer method can automatically find the ListView control by examining the control tree.

適用於

另請參閱