EmptyDataTemplate
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.
Download
For further understanding of this post, you can download the source code (by VWD 2008) via here.
Monday, March 14, 2011
Subscribe to:
Post Comments (Atom)
Popular Posts
-
Recently I encountered a case when I knew much more about the data than the optimizer. Originally the performance was horrible, this is why...
-
ASP.NET 4 adds built-in support for using routing with Web Forms. Routing lets you configure an application to accept request URLs that do...
-
Introduction Web Service is known as the software program. These services use the XML to exchange the information with the other software wi...
-
Most experienced developers will tell you that end users tend to "judge an application by its cover". In other words, they don...
-
Introduction Advanced Integration is for sellers who want more flexibility when creating payment buttons. Advanced Integration facilitates t...
No comments:
Post a Comment