Highlighting GridView
Rows
Imagine that you want to highlight particular rows in GridView
. For example, when displaying a table of sales totals, you might want to highlight the rows in which the sales are greater than a certain amount.
You can modify the appearance of individual rows in a GridView
control by handling the RowDataBound
event. For example, the page in Listing 11.28 displays every movie that has a box office total greater than $300,000.00 with a yellow background color (see Figure 11.20).
Figure 11.20. Highlighting rows in the GridView
control.
Listing 11.28. HighlightRows.aspx
In Listing 11.28, the grdMovies_RowDataBound()
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.