Joseph Michael Pesch
VP Programming

C# Gridview History Highlight Example

by 16. December 2008 14:52

This sample loads a GridView and performs the two functions shown below.  The first function is simply to make the column labels more user friendly by adding spaces.  The second function is relevant to the historical aspect of the data being viewed.  It was intended as a method to load a grid of audit trail type changes to a single record.  The comparison will then highlight changed values so they stand out visually against the unchanged values.

  1. Performs a string replacement on the column names, putting spaces at every captial letter. For example: "ThisColumnName" would be converted to "This Column Name".
  2. Performs a column-by-column record comparison of the current row in the GridView (using a RegEx function) against the next row in the DataTable, and if the values don't match the GridView column is highlighted yellow. Note: It is best presented with newest records on top.

GridViewHistoryHighlight.zip (5.57 kb)

Tags:

ASP.Net | C#

Comments are closed