This documentation is archived and is not being maintained.

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)

[PersistenceModeAttribute(PersistenceMode::InnerProperty)]
[BrowsableAttribute(false)]
[TemplateContainerAttribute(typeof(ListViewItem))]
public:
virtual property ITemplate^ GroupTemplate {
	ITemplate^ get ();
	void set (ITemplate^ value);
}
<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 nullptr, 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.

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.

.NET Framework

Supported in: 3.5
Show: