Export (0) Print
Expand All
Expand Minimize

ListView.GroupTemplate Property

Gets or sets the user-defined content for the group container in a ListView control.

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

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

Property Value

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

Use the GroupTemplate property to create a tiled layout in the ListView control. In a tiled table layout, the items are repeated horizontally in a row. The numbers of times that an item is repeated is specified by the GroupItemCount property.

To specify a template declaratively for the group container, add a GroupTemplate element inside the ListView control. You can then add the contents of the template to the GroupTemplate element.

The GroupTemplate property must include a placeholder for the data item, such as a table cell (td), div, or span element. This placeholder must have the runat attribute set to "server" and the ID attribute set to the value of the ItemPlaceholderID property. At run time, the ListView control replaces the placeholder with the content that is defined for each item in the ItemTemplate and AlternatingItemTemplate templates.

The following example shows how to create a tiled layout in the ListView control by using the GroupTemplate property.

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

.NET Framework

Supported in: 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