ListView control: EmptyDataItem vs EmptyItemTemplate

The new ListView control has two properties that you might confuse when you start using the control. As you may have guessed by this post, they have different purposes (but they”re both templates).

The EmptyDataItem lets you set the aspect of the control when its DataSource property is null ,,)ie, the control will render that template when it has no items to show).

The EmptyItemTemplate is used only when you”re using grouping. When you do that, your control will output something like this:

A | B | C
D |E | F

….

In the previous schema, each group has at most 3 elements: each line represents a group and each letter represents an item that the control is showing. Now suppose that in the previous example you only have 5 elements:

A | B | C
D |E | XXX

If you specify a template for the EmptyItemTemplate property, then the control will render the XXX item with the contents you specify in that template.

Advertisements

~ by Luis Abreu on November 7, 2007.

2 Responses to “ListView control: EmptyDataItem vs EmptyItemTemplate”

  1. Thanks!

  2. Thanks!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

 
%d bloggers like this: