LoadItemsEventArgs Class
Assembly: System.Web.Mobile (in system.web.mobile.dll)
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.
Note: |
|---|
| 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>
- AspNetHostingPermission for operating in a hosted environment. Demand value: LinkDemand; Permission value: Minimal.
- AspNetHostingPermission for operating in a hosted environment. Demand value: InheritanceDemand; Permission value: Minimal.
Windows 98, Windows Server 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 Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.
Note: