Listview and EmptyItemtemplate

There exist only a few articles (Andreas Kraus and Rick Strahl) which describe the usage of listview and datapager. This both controls are "new" to ASP.NET 3.5. The truth is if you use it you can still run it with .NET 2.0, but that's a different story.

I found no/thero information about the EmptyItemTemplate. The EmptyDatatemplate displays alternate content when no data is present ( and no InsertItemTemplate is present- yet another story).

But what is the purpose of Emptyitemtemplate?

Not what you expect.

After searching for source (it is in Microsoft.Web.Extensions) and view it with reflector I found out that this is only displayed in conjunction with GroupTemplate. This is the "fill" HTML code if the groupitemcount is not from multiple of the number of items to display.

Confused? a picture says more then thousand words ;-)

image

The groupitemcount is three, pagesize 5. So one group have only two entry's. In that case EmptyItemTemplate is displayed.

Why this happens in my case on top of page is still mystic.

One word to the concept of Listview: I thing its to complex. Div or else must be named by ID and ID's must be set as attribute (or use default names). When something went wrong its very complicated to found the issue. The templates are linked over the ID's in a kind of internal way. It's a complete different approach as other ASP.NET controls are using. At the moment I don’t like it.

1 Comment

  • Good Evening Hannes,

    I agree with you, at the moment the ListView is producing headaches whenever you want to use all the features it offers as they are not fully implented yet. Despite the missing SEO capabilities of the DataPager the Grouping features need to get more love for the final release.

    I talked to Scott Gu lately and it sounds like the ListView (and DataPager) is getting a makeover before we see the RTM release.

    Until then I use the ListView together with the custom DataPager class by Polita Huff and try not to use the Grouptemplate feature until it's fully usable. I'd love to see more ways of firing the Grouptemplate up instead of a simple GroupItemCount.

    What I like is that you have full control when it comes to the (X)HTML rendering, I really missed that when using the GridView Control.

    Best Regards,
    Andreas

Comments have been disabled for this content.