PagedControl.ItemsPerPage 속성

정의

페이지를 매긴 후 각 페이지에 표시되는 항목 수를 가져오거나 설정합니다. 이 API는 더 이상 사용되지 않습니다. ASP.NET 모바일 애플리케이션을 개발하는 방법에 대한 자세한 내용은 ASP.NET 있는 Mobile Apps & 사이트를 참조하세요.

public:
 property int ItemsPerPage { int get(); void set(int value); };
[System.ComponentModel.Bindable(true)]
public int ItemsPerPage { get; set; }
[<System.ComponentModel.Bindable(true)>]
member this.ItemsPerPage : int with get, set
Public Property ItemsPerPage As Integer

속성 값

페이지를 매긴 후 각 페이지에 표시되는 항목 수입니다.

특성

예제

다음 코드 예제를 사용 하는 방법을 보여 줍니다는 ItemsPerPage 8 페이지당 200 항목 목록의 항목을 렌더링 하는 속성입니다.

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

<script runat="server">
    // Called by the List whenever it needs new items
    private void LoadNow(object sender, LoadItemsEventArgs e)
    {
        int j = e.ItemIndex;
        int estItemSize = 110;

        // Get the optimum page weight for the device
        int wt = Form1.Adapter.Page.Adapter.OptimumPageWeight;
        // Get the number of items per page
        List1.ItemsPerPage = wt / estItemSize;
 
        // Clear the current items
        List1.Items.Clear();

        // Build a section of the array
        ArrayList arr= new ArrayList();
        for (int i = 1; i <= e.ItemCount; i++)
        {
            int v = i + j;
            arr.Add((v.ToString() + " List Item"));
        }

        // Assign the array to the list
        List1.DataSource = arr;
        List1.DataBind();
    }
</script>

<html xmlns="http://www.w3.org/1999/xhtml" >
<body>
    <mobile:Form id="Form1" runat="server" Paginate="true">
        <mobile:List id="List1" runat="server" 
            ItemCount="200" onLoadItems="LoadNow" />
    </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">
    ' Called by the List whenever it needs new items
    Private Sub LoadNow(ByVal sender As Object, _
        ByVal e As LoadItemsEventArgs)
        
        Dim i, j As Integer
        i = 0
        j = e.ItemIndex
        Dim estItemSize As Integer = 110

        ' Get the optimum page weight for the device
        Dim wt As Integer = _
            form1.Adapter.Page.Adapter.OptimumPageWeight
        ' Get the number of items per page
        List1.ItemsPerPage = wt / estItemSize

        ' Clear the current items
        List1.Items.Clear()
        
        ' Build a section of the array
        Dim arr As New ArrayList()
        For i = 1 To e.ItemCount
            arr.Add(j + i)
        Next
        
        ' Assign the array to the list
        List1.DataSource = arr
        List1.DataBind()
    End Sub

</script>

<html xmlns="http://www.w3.org/1999/xhtml" >
<body>
    <mobile:form id="form1" runat="server" Paginate="true">
        <mobile:List id="List1" runat="server" 
            ItemCount="200" onLoadItems="LoadNow" 
            ItemsPerPage="8" />
    </mobile:form>
</body>
</html>

설명

0 이면 페이지 매김이이 속성에 의해 영향을 받지 않습니다. 0이 아니면 폼의 페이지를 매길 때 페이지당 표시할 항목을 재정의 합니다. 기본값은 영입니다.

또한 내부 페이지 매김을 지 원하는 모바일 컨트롤 사용자 지정 페이지 매김 기능을 제공 합니다. 일반적으로 이러한 컨트롤을 사용 하면 이러한을 표시할 수 있는 모든 데이터를 제공 해야 합니다. 목록에 있는 항목의 총 수를 지정 하는 개발자는 ItemCount 속성입니다. ItemsPerPage 속성 컨트롤 표시 페이지당 항목 수를 지정 합니다.

적용 대상

추가 정보