Export (0) Print
Expand All
This topic has not yet been rated - Rate this topic

LoadItemsEventArgs Class

Provides event data for ASP.NET mobile controls that support custom pagination.

Namespace: System.Web.UI.MobileControls
Assembly: System.Web.Mobile (in system.web.mobile.dll)

public class LoadItemsEventArgs : EventArgs
public class LoadItemsEventArgs extends EventArgs
public class LoadItemsEventArgs extends EventArgs

The class LoadItemsEventArgs object provides event data with information about how many items to load into the control on demand.

The following code example demonstrates how the OnLoadItems event calls the function LoadNow. The ItemIndex property determines the number of items to be added to an array that is bound to a list. In order to see the effects of this example, you must view the page on a device that can paginate the list.

NoteNote

The following code sample uses the single-file code model and may not work correctly if copied directly into a code-behind file. This code sample must be copied into an empty text file that has an .aspx extension. For more information, see ASP.NET Web Page Code Model.

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

System.Object
   System.EventArgs
    System.Web.UI.MobileControls.LoadItemsEventArgs
Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Windows 98, Windows 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see System Requirements.

.NET Framework

Supported in: 2.0, 1.1
Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

ADD
Show:
© 2014 Microsoft. All rights reserved.