Users must be alerted to cell values in tables of information that have meet some condition, such as exceeding an extreme value (an example would be when temperatures taken during quality control testing indicate a problem at some stage of a manufacturing process because their value has exceeded a safety threshold). Your application would format these values, for instance in a red color, to attract the user's attention to them.
Limited conditional cell formatting using CSS style rules can be performed through the WebGrid control's client-side event model and its support for dynamic cell styling. Create a Javascript function to format the style attribute on a cell's DOM node based on the set of conditional value ranges your application requires (we will refer to this function as your FormatCell function). Next, add client-side event handler functions in Javascript for the InitializeLayout and, if your WebGrid supports the editing of values (e.g., its DisplayLayout.AllowUpdateDefault would evaluate to Yes), AfterCellUpdate events. InitializeLayout fires when the WebGrid is first being displayed, and your event handler needs to loop over the rows in the WebGrid to hand each Cell object to your FormatCell function. AfterCellUpdate fires after the value in a cell changes, and your event handler needs to use the igtbl_getCellById function to get the Cell object and then hand that object to your FormatCell function.
The Cell object's client-side object model (CSOM) has a getValue function for accessing its value, and an Element property through which you can access the DOM node for the table cell depicting the value of that cell in the grid. By setting Cell object properties such as Element.style.backgroundColor = 'green' you can change the appearance of the cell based on conditional factors such as where the cell's value falls within numeric ranges coded into your FormatCell function. A style set onto the DOM node generally takes precedence over styling specified using a CSS class, which is how the Application Styling Framework™ (ASF) initializes the appearance of the WebGrid.
Support for conditional cell formatting using dynamic cell styling depends on the style rules you have chosen to apply and what other WebGrid features are in use. Your implemented solution must deal with any conflicts (for example, a conflict may occur if you dynamically format cells to have a border style while you are also using the built-in active cell border behavior to allow users to "activate" cells on contact.) Dynamic cell styles are transient and will not persist to the Web server.