Panel.Paginate 屬性

定義

取得或設定布林值 (Boolean),指出是否要重新編頁 Panel 控制項。 這個 API 已經過時。 如需如何開發 ASP.NET 行動應用程式的資訊,請參閱 具有 ASP.NET 的Mobile Apps & Sites

public:
 virtual property bool Paginate { bool get(); void set(bool value); };
[System.ComponentModel.Bindable(true)]
public virtual bool Paginate { get; set; }
[<System.ComponentModel.Bindable(true)>]
member this.Paginate : bool with get, set
Public Overridable Property Paginate As Boolean

屬性值

true 表示重新編頁 Panel,否則為 false

屬性

範例

下列程式代碼範例會在分頁的裝置上檢視時,顯示包含多個控件的面板如何編頁,而不是在一個頁面上容納的控件,以允許使用者存取面板上的所有專案。

注意

下列程式代碼範例會使用單一檔案程式代碼模型,如果直接複製到程式代碼後置檔案,可能無法正常運作。 此程式代碼範例必須複製到擴展名為 .aspx 的空白文字檔中。 如需詳細資訊,請參閱 ASP.NET Web Forms 頁碼模型

<%@ Page Language="C#" 
    Inherits="System.Web.UI.MobileControls.MobilePage" %>
<%@ Register TagPrefix="mobile" 
    Namespace="System.Web.UI.MobileControls" 
    Assembly="System.Web.Mobile" %>

<script runat="server">
    protected void Page_Load(object sender, EventArgs e)
    {
        System.Web.UI.MobileControls.Label lab;

        for (int i = 1; i < 16; i++)
        {
            lab = new System.Web.UI.MobileControls.Label();
            lab.Text = i.ToString() + 
                " - This sentence repeats over and over.";
            Panel1.Controls.Add(lab);
        }
        Form1.Paginate = true;
        Panel1.Paginate = true;
    }
</script>

<html xmlns="http://www.w3.org/1999/xhtml" >
<body>
    <mobile:form id="Form1" runat="server">
        <mobile:Panel ID="Panel1" Runat="server">
        </mobile:Panel>
    </mobile:form>
</body>
</html>
<%@ Page Language="VB" 
    Inherits="System.Web.UI.MobileControls.MobilePage" %>
<%@ Register TagPrefix="mobile" 
    Namespace="System.Web.UI.MobileControls" 
    Assembly="System.Web.Mobile" %>

<script runat="server">
    Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs)
        Dim lab As System.Web.UI.MobileControls.Label

        For i As Integer = 1 To 15
            lab = New System.Web.UI.MobileControls.Label()
            lab.Text = i.ToString() & _
                " - This sentence repeats over and over."
            Panel1.Controls.Add(lab)
        Next
        Form1.Paginate = True
        Panel1.Paginate = True
    End Sub
</script>

<html xmlns="http://www.w3.org/1999/xhtml" >
<body>
    <mobile:form id="Form1" runat="server">
        <mobile:Panel ID="Panel1" Runat="server">
        </mobile:Panel>
    </mobile:form>
</body>
</html>

備註

發生窗體分頁之後,就會 Paginated 引發事件。

注意

即使屬性 Paginate 設定 false為 ,如果已設定表單 ControlToPaginate 的 屬性,仍會發生分頁。

注意

若要允許表單的控制件中的 Panel 分頁,您必須在表單和面板中都設定 Paginatetrue

適用於

另請參閱