GridView Examples for ASP.NET 2.0: Formatting the GridView
Hits: 306
Description: GridView examples. In the examples we\'ve looked at so far, the GridView\'s output is a tad drab and unattractive. In Figure 7, for example, the GridView\'s output lacks any color. The text in the header of each column matches the DataSource field names exactly, like ProductName (without a space between Product and Name), whereas it would make more sense to display it as Product Name or perhaps just Product. We also might want to have the UnitPrice column formatted as a currency, and have its data right-aligned. Perhaps we want to reorder the columns, or only display a subset of the columns returned by the data source control. Or we may want to employ more advanced formatting, such as changing the background color of the GridView row if there are zero items in stock.