The empty template, EmptyDataTemplate, can be utilized to define the view when there is no data for the ListView, which means that the ListView control is bound to a DataSource having no records. In reality, this template is rendered instead of LayoutTemplate when ListView is empty. It renders by itself, therefore it is not required to be defined inside any other ListView templates.
I have defined the Select command of AccessDataSource1 in a way that it returns zero record, and put the empty template right after AlternatingItemTemplate between the ListView tags:
In order to hide the “Clear Sorting” and “View All” buttons when our ListView is empty, I will set their visibility values to False inside the Page_Load method when the DataSource (AccessDataSource1) has no records:
As a result of all these changes, the HTML presentation should look like:
It should also be known that…
Even though ListView is empty, EmptyDataTemplate can only be displayed when InsertItemPosition value is set to None (which is the default if the value is not defined). InsertItemPosition defines the location of InsertItemTemplate when it is rendered as a part of ListView.
For further understanding of this post, you can download the source code (by VWD 2008) via here.
Recently I encountered a case when I knew much more about the data than the optimizer. Originally the performance was horrible, this is why...
Introduction Web Service is known as the software program. These services use the XML to exchange the information with the other software wi...
Introduction Advanced Integration is for sellers who want more flexibility when creating payment buttons. Advanced Integration facilitates t...
Most experienced developers will tell you that end users tend to "judge an application by its cover". In other words, they don'...
Dependency Injection (DI) is a software design pattern. Dependency Injection reduces the hard-coded dependencies among your classes by inje...