Formatting the GridView Control

The GridView control includes a rich set of formatting properties that you can use to modify its appearance. I recommend that you don’t use most of these properties because using these properties results in bloated pages. Instead, I recommend that you use Cascading Style Sheets (CSS) to format the GridView control.

The GridView control includes a CssClass property. The control also exposes several Style objects that include the CssClass property:

AlternatingRowStyle Enables you to format every other row.

FooterStyle Enables you to format the footer row.

HeaderStyle Enables you to format the header row.

PagerStyle Enables you to format the pager row.

RowStyle Enables you to format each row.

SelectedRowStyle ...

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.