Share via


LoadItemsEventArgs Kelas

Definisi

Perhatian

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.

Menyediakan data peristiwa untuk kontrol seluler ASP.NET yang mendukung penomoran halaman kustom. Untuk informasi tentang cara mengembangkan aplikasi seluler ASP.NET, lihat Situs & Mobile Apps dengan ASP.NET.

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
Warisan
LoadItemsEventArgs
Atribut

Contoh

Contoh kode berikut menunjukkan bagaimana OnLoadItems peristiwa memanggil fungsi LoadNow. Properti ItemIndex menentukan jumlah item yang akan ditambahkan ke array yang terikat ke daftar. Untuk melihat efek dari contoh ini, Anda harus melihat halaman pada perangkat yang dapat membuat paginasi daftar.

Catatan

Sampel kode berikut menggunakan model kode file tunggal dan mungkin tidak berfungsi dengan benar jika disalin langsung ke file code-behind. Sampel kode ini harus disalin ke dalam file teks kosong yang memiliki ekstensi .aspx. Untuk informasi selengkapnya, lihat Model Kode Halaman Formulir Web ASP.NET.

<%@ 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>

Keterangan

Objek kelas LoadItemsEventArgs menyediakan data peristiwa dengan informasi tentang berapa banyak item yang akan dimuat ke dalam kontrol sesuai permintaan.

Konstruktor

LoadItemsEventArgs(Int32, Int32)
Kedaluwarsa.

Menginisialisasi instans baru kelas LoadItemsEventArgs. API ini kedaluarsa. Untuk informasi tentang cara mengembangkan aplikasi seluler ASP.NET, lihat Situs & Mobile Apps dengan ASP.NET.

Properti

ItemCount
Kedaluwarsa.

Mendapatkan atau mengatur jumlah item dalam kontrol. API ini kedaluarsa. Untuk informasi tentang cara mengembangkan aplikasi seluler ASP.NET, lihat Situs & Mobile Apps dengan ASP.NET.

ItemIndex
Kedaluwarsa.

Mendapatkan indeks item pertama yang akan dimuat oleh peristiwa yang dipanggil. API ini kedaluarsa. Untuk informasi tentang cara mengembangkan aplikasi seluler ASP.NET, lihat Situs & Mobile Apps dengan ASP.NET.

Metode

Equals(Object)
Kedaluwarsa.

Menentukan apakah objek yang ditentukan sama dengan objek saat ini.

(Diperoleh dari Object)
GetHashCode()
Kedaluwarsa.

Berfungsi sebagai fungsi hash default.

(Diperoleh dari Object)
GetType()
Kedaluwarsa.

Mendapatkan dari instans Type saat ini.

(Diperoleh dari Object)
MemberwiseClone()
Kedaluwarsa.

Membuat salinan dangkal dari saat ini Object.

(Diperoleh dari Object)
ToString()
Kedaluwarsa.

Mengembalikan string yang mewakili objek saat ini.

(Diperoleh dari Object)

Berlaku untuk

Lihat juga