LoadItemsEventArgs Clase

Definición

Precaución

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.

Proporciona datos de eventos para controles ASP.NET mobile que admiten la paginación personalizada. Para obtener información sobre cómo desarrollar aplicaciones móviles ASP.NET, consulte Mobile Apps & 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
Herencia
LoadItemsEventArgs
Atributos

Ejemplos

En el ejemplo de código siguiente se muestra cómo el OnLoadItems evento llama a la función LoadNow. La ItemIndex propiedad determina el número de elementos que se van a agregar a una matriz enlazada a una lista. Para ver los efectos de este ejemplo, debe ver la página en un dispositivo que pueda paginar la lista.

Nota:

En el ejemplo de código siguiente se usa el modelo de código de un solo archivo y es posible que no funcione correctamente si se copia directamente en un archivo de código subyacente. Este ejemplo de código debe copiarse en un archivo de texto vacío que tenga una extensión .aspx. Para obtener más información, consulte ASP.NET Web Forms modelo de código de página.

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

Comentarios

El objeto de clase LoadItemsEventArgs proporciona datos de eventos con información sobre cuántos elementos se van a cargar en el control a petición.

Constructores

LoadItemsEventArgs(Int32, Int32)
Obsoletos.

Inicializa una nueva instancia de la clase LoadItemsEventArgs. Esta API está obsoleta. Para obtener información sobre cómo desarrollar aplicaciones móviles ASP.NET, consulte Mobile Apps & Sites with ASP.NET.

Propiedades

ItemCount
Obsoletos.

Obtiene o establece el número de elementos del control. Esta API está obsoleta. Para obtener información sobre cómo desarrollar aplicaciones móviles ASP.NET, consulte Mobile Apps & Sites with ASP.NET.

ItemIndex
Obsoletos.

Obtiene el índice del primer elemento que va a cargar el evento invocado. Esta API está obsoleta. Para obtener información sobre cómo desarrollar aplicaciones móviles ASP.NET, consulte Mobile Apps & Sites with ASP.NET.

Métodos

Equals(Object)
Obsoletos.

Determina si el objeto especificado es igual que el objeto actual.

(Heredado de Object)
GetHashCode()
Obsoletos.

Sirve como la función hash predeterminada.

(Heredado de Object)
GetType()
Obsoletos.

Obtiene el Type de la instancia actual.

(Heredado de Object)
MemberwiseClone()
Obsoletos.

Crea una copia superficial del Object actual.

(Heredado de Object)
ToString()
Obsoletos.

Devuelve una cadena que representa el objeto actual.

(Heredado de Object)

Se aplica a

Consulte también