Export (0) Print
Expand All
Expand Minimize

ListView.AlternatingItemTemplate Property

Gets or sets the custom content for the alternating data item in a ListView control.

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

[<PersistenceModeAttribute(PersistenceMode.InnerProperty)>]
[<TemplateContainerAttribute(typeof(ListViewDataItem), BindingDirection.TwoWay)>]
[<BrowsableAttribute(false)>]
abstract AlternatingItemTemplate : ITemplate with get, set
[<PersistenceModeAttribute(PersistenceMode.InnerProperty)>]
[<TemplateContainerAttribute(typeof(ListViewDataItem), BindingDirection.TwoWay)>]
[<BrowsableAttribute(false)>]
override AlternatingItemTemplate : ITemplate with get, set
<asp:ListView>
	<AlternatingItemTemplate>ITemplate</AlternatingItemTemplate>
</asp:ListView>

Property Value

Type: System.Web.UI.ITemplate
An object that contains the custom content for the alternating data item in a ListView control. The default is a null reference (Nothing in Visual Basic), which indicates that this property is not set.

Use the AlternatingItemTemplate property to define a custom user interface (UI) for the alternating data item. The AlternatingItemTemplate template usually contains the same controls and content as the ItemTemplate template, but with a different appearance to distinguish items.

To specify the custom template declaratively, add an AlternatingItemTemplate element inside the ListView control. Then add controls and content between the opening and closing <AlternatingItemTemplate> tags. To display the field values from the data source, use a data-binding expression. For more information, see Data-Binding Expressions Overview.

To create buttons that automatically select, delete, and edit operations, add a button control to the template. Set its CommandName property to one of the values listed in the following table.

Button type

CommandName value

Delete

"Delete"

Edit

"Edit"

Select

"Select"

The following example shows how to use the AlternatingItemTemplate template to define the style for alternating data items in a ListView control.

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

.NET Framework

Supported in: 4.5.2, 4.5.1, 4.5, 4, 3.5

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.

Show:
© 2014 Microsoft