Export (0) Print
Expand All
Expand Minimize

ListView.EmptyDataTemplate Property

Gets or sets the user-defined content for the empty template that is rendered when a ListView control is bound to a data source that does not contain any records.

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

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

Property Value

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

The empty template is displayed in a ListView control when the data source that is bound to the control does not contain any records and the InsertItemPosition property is set to InsertItemPosition.None. The template is rendered instead of the LayoutTemplate template. If the InsertItemPosition property is set to a value other than InsertItemPosition.None, the EmptyDataTemplate template is not rendered.

You can define a custom user interface (UI) for the empty template by using the EmptyDataTemplate property. To specify a custom template declaratively for the empty template, add and EmptyDataTemplate element inside the ListView control. You can then add the contents of the template to the EmptyDataTemplate element.

The following example shows how to define a custom template for the empty template.

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