LoadItemsEventArgs 類別

定義

警告

The System.Web.Mobile.dll assembly has been deprecated and should no longer be used. For information about how to develop ASP.NET mobile applications, see http://go.microsoft.com/fwlink/?LinkId=157231.

提供支援自訂分頁之 ASP.NET Mobile 控制項的事件資料。 如需如何開發 ASP.NET 行動應用程式的資訊,請參閱 具有 ASP.NET 的Mobile Apps & Sites

public ref class LoadItemsEventArgs : EventArgs
public class LoadItemsEventArgs : EventArgs
[System.Obsolete("The System.Web.Mobile.dll assembly has been deprecated and should no longer be used. For information about how to develop ASP.NET mobile applications, see http://go.microsoft.com/fwlink/?LinkId=157231.")]
public class LoadItemsEventArgs : EventArgs
type LoadItemsEventArgs = class
    inherit EventArgs
[<System.Obsolete("The System.Web.Mobile.dll assembly has been deprecated and should no longer be used. For information about how to develop ASP.NET mobile applications, see http://go.microsoft.com/fwlink/?LinkId=157231.")>]
type LoadItemsEventArgs = class
    inherit EventArgs
Public Class LoadItemsEventArgs
Inherits EventArgs
繼承
LoadItemsEventArgs
屬性

範例

下列程式代碼範例示範事件如何 OnLoadItems 呼叫 函式 LoadNow。 屬性 ItemIndex 會決定要加入至系結至清單的陣列的項目數。 若要查看此範例的效果,您必須在可分頁清單的裝置上檢視頁面。

注意

下列程式代碼範例會使用單一檔案程式代碼模型,如果直接複製到程式代碼後置檔案,可能無法正常運作。 此程式代碼範例必須複製到擴展名為 .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">
    // 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>

備註

類別 LoadItemsEventArgs 物件會提供事件數據,以及要隨選載入控件的項目數目相關信息。

建構函式

LoadItemsEventArgs(Int32, Int32)
已淘汰.

初始化 LoadItemsEventArgs 類別的新執行個體。 這個 API 已經過時。 如需如何開發 ASP.NET 行動應用程式的資訊,請參閱 具有 ASP.NET 的Mobile Apps & Sites

屬性

ItemCount
已淘汰.

取得或設定控制項中的項目計數。 這個 API 已經過時。 如需如何開發 ASP.NET 行動應用程式的資訊,請參閱 具有 ASP.NET 的Mobile Apps & Sites

ItemIndex
已淘汰.

取得由叫用的事件所載入之第一個項目的索引。 這個 API 已經過時。 如需如何開發 ASP.NET 行動應用程式的資訊,請參閱 具有 ASP.NET 的Mobile Apps & Sites

方法

Equals(Object)
已淘汰.

判斷指定的物件是否等於目前的物件。

(繼承來源 Object)
GetHashCode()
已淘汰.

做為預設雜湊函式。

(繼承來源 Object)
GetType()
已淘汰.

取得目前執行個體的 Type

(繼承來源 Object)
MemberwiseClone()
已淘汰.

建立目前 Object 的淺層複製。

(繼承來源 Object)
ToString()
已淘汰.

傳回代表目前物件的字串。

(繼承來源 Object)

適用於

另請參閱