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)

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

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 null, 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
Available since 3.5
Return to top
Show: