Export (0) Print
Expand All

DataListItemCollection Class

Represents the collection of DataListItem objects in the DataList control. This class cannot be inherited.

System::Object
  System.Web.UI.WebControls::DataListItemCollection

Namespace:  System.Web.UI.WebControls
Assembly:  System.Web (in System.Web.dll)

public ref class DataListItemCollection sealed : ICollection, 
	IEnumerable

The DataListItemCollection type exposes the following members.

  NameDescription
Public methodDataListItemCollectionInitializes a new instance of the DataListItemCollection class.
Top

  NameDescription
Public propertyCountGets the number of DataListItem objects in the collection.
Public propertyIsReadOnlyGets a value that indicates whether the DataListItem objects in the DataListItemCollection can be modified.
Public propertyIsSynchronizedGets a value indicating whether access to the DataListItemCollection is synchronized (thread-safe).
Public propertyItemGets a DataListItem object at the specified index in the collection.
Public propertySyncRootGets the object that can be used to synchronize access to the DataListItemCollection collection.
Top

  NameDescription
Public methodCopyToCopies all the items from this DataListItemCollection collection to the specified System::Array object, starting at the specified index in the System::Array object.
Public methodEquals(Object)Determines whether the specified object is equal to the current object. (Inherited from Object.)
Public methodGetEnumeratorReturns a System.Collections::IEnumerator interface that contains all DataListItem objects in the DataListItemCollection.
Public methodGetHashCodeServes as the default hash function. (Inherited from Object.)
Public methodGetTypeGets the Type of the current instance. (Inherited from Object.)
Public methodToStringReturns a string that represents the current object. (Inherited from Object.)
Top

  NameDescription
Public Extension MethodAsParallelEnables parallelization of a query. (Defined by ParallelEnumerable.)
Public Extension MethodAsQueryableConverts an IEnumerable to an IQueryable. (Defined by Queryable.)
Public Extension MethodCast<TResult>Casts the elements of an IEnumerable to the specified type. (Defined by Enumerable.)
Public Extension MethodOfType<TResult>Filters the elements of an IEnumerable based on a specified type. (Defined by Enumerable.)
Top

The DataListItemCollection class represents a collection of DataListItem objects, which in turn represent the data items in a DataList control. To programmatically retrieve DataListItem objects from a DataList control, use one of the following methods:

  • Use the indexer to get a single DataListItem object from the collection, using array notation.

  • Use the CopyTo method to copy the contents of the collection to a System::Array object, which can then be used to get items from the collection.

  • Use the GetEnumerator method to create a System.Collections::IEnumerator interface, which can then be used to get items from the collection.

The Count property specifies the total number of items in the collection and is commonly used to determine the upper bound of the collection.

The following example creates a data source in the form of a DataView control and binds it to a DataList control declared in markup. It then displays the contents of the underlying DataListItemCollection object on the page.

No code example is currently available or this language may not be supported.

.NET Framework

Supported in: 4.5, 4, 3.5, 3.0, 2.0, 1.1, 1.0

Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)

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

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.
Show:
© 2014 Microsoft