17.4. Working with the Conditional Formatting Task Pane

The Data Form Web Part, like its predecessor Front Page 2003, allows you to format rows of data based on conditions. You can apply formatting to rows in your data view when the data in the rows meets a certain criteria. You can also hide or show rows of data based on whether they match a particular condition. This is especially useful in situations when you need to highlight data in your presentations when certain conditions and requirements are met. This feature in SharePoint Designer is called conditional formatting.

Conditional formatting, like most of the formatting features of the Data Form Web Part, is also implemented by using the XSLT formatting. It doesn't mean to change how the data is retrieved from the data source but to apply XSLT to the data retrieved to show, hide, or apply formatting based on the conditions set. You use the familiar Filter Criteria dialog box to create conditions that when met apply the specified formatting to the matching rows of data.

You use the Conditional Formatting task pane to create conditional formatting conditions. As shown in Figure 17.35, the Conditional Formatting task pane by default shows the existing conditions that apply to the selected content on the Web page.

To create a new condition, follow these steps:

  1. Select the HTML component on the Web page on which you want to apply the formatting based on the condition. For example, you can select the <tr> tag in the data view if you want to apply the formatting to the row or the <td> tag if you want to apply the formatting to just a column in the data view.

  2. Click Create menu in the Conditional Formatting task pane. You have three options: Show Content, Hide Content, and Apply Formatting. The Show Content and Hide Content options show or hide the content based on the condition, while Apply Formatting lets you specify the formatting that needs to be applied to the data that needs the condition.

  3. Click the Apply Formatting menu option. The Condition Criteria dialog box opens, offering the same interface as the Filter Criteria dialog box, which you used earlier in this chapter to create filters on the data view.

  4. Using the Conditions Criteria dialog box, specify the condition that when met applies the formatting to the row of data.

  5. Click OK. The Modify Style dialog box opens, which you should be familiar with from using CSS styles.

  6. Use the Modify Style dialog box to specify the formatting that you want to apply to the rows that meet the condition specified in step 4.

  7. Click OK, save the Web page, and then preview it in a browser.

The rows to data that matched your condition have the specified formatting applied to them. Similarly, you can use conditional formatting to show or hide content based on conditions.

Figure 17.35. The Conditional Formatting task pane

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
13.58.115.61