Apply conditional formatting to a Data View

With conditional formatting, you can create a Data View that applies a style to a selected HTML tag or data value when the data meets criteria that you specify. You can also set conditions that change the visibility of an HTML tag or data value, so you can show or hide data altogether.

With Microsoft Expression Web, you can use XML Path Language (XPath) to build expressions that specify conditions for when to apply conditional formatting. XPath is a language for locating and processing information in an XML document. Expression Web makes it possible for both novices and advanced users to create XPath expressions that perform complex functions on XML data.

To apply conditional formatting

  1. With the page in Design view, right-click the Data View, and then click Conditional Formatting. The Conditional Formatting panel opens.

  2. In the Data View, select any cell other than the header cell, such as the HTML tag, data value, or range of text in the field that you want to format.

    Tip

    To quickly select the entire cell, right-click inside the cell, point to Select on the shortcut menu, and then click Cell.

  3. In the Conditional Formatting panel, click Create, and then click Apply Formatting.

    Note

    If the Create button is not available, the selection cannot have conditional formatting applied to it.

  4. In the Condition Criteria dialog box, click anywhere in the first row to add a new clause, and then do the following:

    • Under Field Name, click the arrow, and then click the field that you want in the list.

    • Under Comparison, click the arrow, and then click the comparison that you want.

    • Under Value, click the arrow, and then click More Fields. In the More Fields dialog box, click the field that you want, and then click OK.

      Note

      By using the AND and OR operators and adding additional clauses, you can create criteria that specify multiple conditions.

Now that you have created the condition, you can apply the formatting:

  1. In the Condition Criteria dialog box, click OK.

  2. In the Modify Style dialog box, choose options to create the style for your conditional formatting.

Because a Data View is a view of live data, you see the conditional formatting applied immediately in Design view.

See also

Tasks

Add a Data View
Sort data in a Data View
Create a formula column in a Data View
Change the layout of a Data View
Modify the columns in a Data View
Filter data in a Data View
Add RSS feeds to a page
Display sample data in a Data View

Concepts

Data View

Send feedback about this topic to Microsoft. © 2011 Microsoft Corporation. All rights reserved.