ListViewItem Class
Represents an individual item in a ListView control.
Assembly: System.Web.Extensions (in System.Web.Extensions.dll)
[AspNetHostingPermissionAttribute(SecurityAction::LinkDemand, Level = AspNetHostingPermissionLevel::Minimal)] [AspNetHostingPermissionAttribute(SecurityAction::InheritanceDemand, Level = AspNetHostingPermissionLevel::Minimal)] public ref class ListViewItem : public Control, INamingContainer
<asp:ListViewItem />
The ListViewItem class is used to represent an individual item in a ListView control. An individual item usually represents a record in the underlying data source of a ListView control.
Each item in the ListView control has a designated item type, as listed in the following table.
Item type | Description |
|---|---|
A data item in the ListView control. | |
An insert item in the ListView control. | |
An empty item in the ListView control. The empty item is displayed when the ListView control does not have any records to display, or when a group in the ListView control does not have any more records to display. |
To determine the type of a ListViewItem object, use the ItemType property.
If an item contains other controls, you can retrieve a control by using the Controls collection of the item. If the control's ID property is set, you can also use the FindControl method to find the control.
For a list of initial property values for an instance of ListViewItem, see the ListViewItem constructor.
The following example shows how to use the ListViewItem class to access the properties of the item that is being created in the ListView control.
Security Note: |
|---|
This example has a text box that accepts user input, which is a potential security threat. By default, ASP.NET Web pages validate that user input does not include script or HTML elements. For more information, see Script Exploits Overview. |
- AspNetHostingPermission
for operating in a hosted environment. Demand value: LinkDemand. Associated enumeration: AspNetHostingPermissionLevel::Minimal
- AspNetHostingPermission
for operating in a hosted environment. Demand value: InheritanceDemand. Associated enumeration: AspNetHostingPermissionLevel::Minimal
System.Web.UI::Control
System.Web.UI.WebControls::ListViewItem
System.Web.UI.WebControls::ListViewDataItem
Windows 7, Windows Vista, Windows XP SP2, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003
The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.
Security Note: