Using the LayoutTemplate and ItemTemplate

Let’s start with a ListView control simple scenario in which you might want to use the ListView control. Suppose that you have a set of database records that you want to display in a set of HTML <div> tags. The page in Listing 14.1 illustrates how you can use the LayoutTemplate and ItemTemplate templates to display the records from the Movie database table.

Listing 14.1. SimpleListView.aspx

images

images

The ListView control in Listing 14.1 contains five templates. First, the LayoutTemplate creates a single containing ...

Get ASP.NET 4 Unleashed now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.