Export (0) Print
Expand All
Expand Minimize

DetailsView::EmptyDataTemplate Property

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

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

[BrowsableAttribute(false)]
[PersistenceModeAttribute(PersistenceMode::InnerProperty)]
[TemplateContainerAttribute(typeof(DetailsView))]
public:
virtual property ITemplate^ EmptyDataTemplate {
	ITemplate^ get ();
	void set (ITemplate^ value);
}
<asp:DetailsView>
	<EmptyDataTemplate>ITemplate</EmptyDataTemplate>
</asp:DetailsView>

Property Value

Type: System.Web.UI::ITemplate
A System.Web.UI::ITemplate that contains the custom content for the empty data row. The default value is nullptr, which indicates that this property is not set.

The empty data row is displayed in a DetailsView control when the data source that is bound to the control does not contain any records. You can define your own custom user interface (UI) for the empty data row by using the EmptyDataTemplate property. To specify a custom template for the null row, first place <EmptyDataTemplate> tags between the opening and closing tags of the DetailsView control. You can then list the contents of the template between the opening and closing <EmptyDataTemplate> tags. To control the style of the empty data row, use the EmptyDataRowStyle property. Alternatively, you can use the built-in UI for the empty data row by setting the EmptyDataText property instead of this property.

NoteNote

If both the EmptyDataText and EmptyDataTemplate properties are set, the EmptyDataTemplate property takes precedence.

The following code example demonstrates how to use the EmptyDataTemplate property to create a custom empty data row.

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

.NET Framework

Supported in: 4.5, 4, 3.5, 3.0, 2.0

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