Advising Users there’s no Data with EmptyDataTemplate

Advising Users there’s no Data with EmptyDataTemplate

In ASP.NET, you can use the EmptyDataTemplate property of a data control to display a message when there is no data to display. Here is an example:

<asp:ListView ID=”myListView” runat=”server” DataSourceID=”myLinqDataSource”>

    <EmptyDataTemplate>

        <p>Sorry, there is no data to display.</p>

    </EmptyDataTemplate>

    <ItemTemplate>

        <!– template for displaying data items –>

    </ItemTemplate>

    <EditItemTemplate>

        <!– template for editing data items –>

    </EditItemTemplate>

    <InsertItemTemplate>

        <!– template for inserting new data items –>

    </InsertItemTemplate>

</asp:ListView> In this example, if the myLinqDataSource data source does not return any data, the EmptyDataTemplate will be displayed instead of the ItemTemplate. The EmptyDataTemplate contains a simple message to inform the user that there is no data to display. You can customize this message to suit your needs.

Apply for ASP.NET Certification Now!!

https://www.vskills.in/certification/certified-aspnet-programmer

Back to Tutorial

Adding Records with InsertItemTemplate
Using the ItemSeparatorTemplate

Get industry recognized certification – Contact us

keyboard_arrow_up
Open chat
Need help?
Hello 👋
Can we help you?