LoadItemsEventArgs Klasa

Definicja

Przestroga

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.

Udostępnia dane zdarzeń dla ASP.NET kontrolek mobilnych, które obsługują niestandardowe stronicowanie. Aby uzyskać informacje na temat tworzenia ASP.NET aplikacji mobilnych, zobacz Mobile Apps & Sites with ASP.NET (Aplikacje mobilne & Sites with 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
Dziedziczenie
LoadItemsEventArgs
Atrybuty

Przykłady

W poniższym przykładzie kodu pokazano, jak OnLoadItems zdarzenie wywołuje funkcję LoadNow. Właściwość ItemIndex określa liczbę elementów do dodania do tablicy powiązanej z listą. Aby zobaczyć efekty tego przykładu, należy wyświetlić stronę na urządzeniu, które może stronicować listę.

Uwaga

Poniższy przykładowy kod używa modelu kodu z jednym plikiem i może nie działać poprawnie, jeśli został skopiowany bezpośrednio do pliku za pomocą kodu. Ten przykładowy kod musi zostać skopiowany do pustego pliku tekstowego z rozszerzeniem aspx. Aby uzyskać więcej informacji, zobacz model kodu strony 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>

Uwagi

Obiekt klasy LoadItemsEventArgs udostępnia dane zdarzeń z informacjami o tylu elementach, które należy załadować do kontrolki na żądanie.

Konstruktory

LoadItemsEventArgs(Int32, Int32)
Przestarzałe.

Inicjuje nowe wystąpienie klasy LoadItemsEventArgs. Ten interfejs API jest nieaktualny. Aby uzyskać informacje na temat tworzenia ASP.NET aplikacji mobilnych, zobacz Mobile Apps & Sites with ASP.NET (Aplikacje mobilne & Sites with ASP.NET).

Właściwości

ItemCount
Przestarzałe.

Pobiera lub ustawia liczbę elementów w kontrolce. Ten interfejs API jest nieaktualny. Aby uzyskać informacje na temat tworzenia ASP.NET aplikacji mobilnych, zobacz Mobile Apps & Sites with ASP.NET (Aplikacje mobilne & Sites with ASP.NET).

ItemIndex
Przestarzałe.

Pobiera indeks pierwszego elementu, który ma zostać załadowany przez wywołane zdarzenie. Ten interfejs API jest nieaktualny. Aby uzyskać informacje na temat tworzenia ASP.NET aplikacji mobilnych, zobacz Mobile Apps & Sites with ASP.NET (Aplikacje mobilne & Sites with ASP.NET).

Metody

Equals(Object)
Przestarzałe.

Określa, czy dany obiekt jest taki sam, jak bieżący obiekt.

(Odziedziczone po Object)
GetHashCode()
Przestarzałe.

Służy jako domyślna funkcja skrótu.

(Odziedziczone po Object)
GetType()
Przestarzałe.

Type Pobiera wartość bieżącego wystąpienia.

(Odziedziczone po Object)
MemberwiseClone()
Przestarzałe.

Tworzy płytkią kopię bieżącego Objectelementu .

(Odziedziczone po Object)
ToString()
Przestarzałe.

Zwraca ciąg reprezentujący bieżący obiekt.

(Odziedziczone po Object)

Dotyczy

Zobacz też