MobileListItemCollection Class

Represents a collection of MobileListItem objects, and is used to hold the items of a List control and a SelectionList control.

Namespace: System.Web.UI.MobileControls
Assembly: System.Web.Mobile (in

Public Class MobileListItemCollection
	Inherits ArrayListCollectionBase
	Implements IStateManager
Dim instance As MobileListItemCollection

public class MobileListItemCollection extends ArrayListCollectionBase implements IStateManager
public class MobileListItemCollection extends ArrayListCollectionBase implements IStateManager
Not applicable.

Accessing the Items property of a List control or the Items property of a SelectionList control retrieves a MobileListItemCollection object. You can add or remove items from the collection at run time.

A MobileListItemCollection object inherits from the ICollection interface.

The following code example shows how you manipulate items in the MobileListItem object through the MobileListItemCollection class. The code uses the selected item's index into the SelectionList.Items property.

<%@ Page Language="VB" 
    Inherits="System.Web.UI.MobileControls.MobilePage" %>
<%@ Register TagPrefix="mobile" 
    Assembly="System.Web.Mobile" %>

<script runat="server">
    Public Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs)
        If Not IsPostBack Then
            Label1.Text = "Select an item"

            ' Create and fill an array list.
            Dim listValues As New ArrayList()

            ' Bind the array to the list.
            SelList1.DataSource = listValues

            ' Set the SelectType.
            SelList1.SelectType = ListSelectType.Radio
            If (SelList1.SelectedIndex > -1) Then
                ' To show the selection, use the Selection property.
                Label1.Text = "Your selection is " & _

                ' Or, show the selection by using 
                ' the MobileListItemCollection class.
                ' Get the index of the selected item
                Dim idx As Integer = SelList1.SelectedIndex
                Label2.Text = "You have selected " & _

                ' Insert a copy of the selected item
                Dim mi As MobileListItem = SelList1.Selection
                Label3.Text = "The index of your selection is " & _
                SelList1.Items.Insert(idx, _
                    New MobileListItem(mi.Text + " Copy"))
                Label1.Text = "No items selected"
            End If
        End If
    End Sub

<html xmlns="http:'" >
    <mobile:form id="form1" runat="server">
        <mobile:Label id="Label1" runat="server" 
            Text="Show a list" />
        <mobile:Label id="Label2" runat="server" />
        <mobile:Label id="Label3" runat="server" />
        <mobile:SelectionList runat="server" 
            id="SelList1" />
        <mobile:Command id="Command1" runat="server" 
            Text=" OK " />

  • 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.


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 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.

.NET Framework

Supported in: 3.0, 2.0, 1.1

Community Additions