Skip to Main Content
ASP.NET 4 24-Hour Trainer
book

ASP.NET 4 24-Hour Trainer

by Toi B. Wright
July 2010
Beginner content levelBeginner
552 pages
10h 14m
English
Wrox
Content preview from ASP.NET 4 24-Hour Trainer

Chapter 22A. Dynamic Data Templates in Web Forms

In Lesson 21A you created a fully functional data-driven application by writing only one line of code. The Dynamic Data framework uses templates to provide the default views for data. It uses entity templates, field templates, and page templates. In this lesson I show you how to customize a page template and how to create a new field template.

PAGE TEMPLATES

The Dynamic Data framework uses five page templates. All of the page templates are just regular ASPX pages. They are:

  • Details.aspx — This page displays the data from a single row of the table.

  • Edit.aspx — This page allows you to edit the data from a single row of the table.

  • Insert.aspx — This page allows you to insert a row into the table.

  • List.aspx — This page lists all of the rows in the table using a GridView control.

  • ListDetails.aspx — This page lists all of the rows in the table using a GridView control and allows you to edit and insert rows using a DetailsView control.

CUSTOM PAGE TEMPLATES

If you make a change to any of the pages in the PageTemplates folder, it will have a global effect on your application. Figure 22A-1 shows the default List.aspx page template.

As you can see the GridView that is used on the default List.aspx page template is not formatted to show alternating rows in a different color. This is the code to have alternating rows of a GridView appear yellow:

<AlternatingRowStyle BackColor="#FFFF99" />

Figure 22A.1. FIGURE 22A-1

If I add the preceding markup to the GridView ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

ASP.NET 4 24-Hour Trainer

ASP.NET 4 24-Hour Trainer

Toi B. Wright
ASP.NET 4 Unleashed

ASP.NET 4 Unleashed

Stephen Walther, Kevin Hoffman, Nate Dudek

Publisher Resources

ISBN: 9780470596913Purchase bookExamplesErrata