Add a Data View

There are two ways to add a data view to your page:

  • Drag the XML data source from the Folder List panel or Data Source Library panel onto a new or existing HTML or ASP.NET page in your site. This adds all the elements in the XML file to your page.

  • Select the individual fields that you want to display from the Data Source Details panel, and add them to your page.

After you create a data view, you can use WYSIWIG tools such as the Formatting toolbar to modify fonts, align text, or apply colors. When you apply new formatting to a data point in your Data View, Microsoft Expression Web applies the formatting to all of the data at the same level in the XML by modifying the XSLT style sheet attached to the page.

Note

To test a data view, you need to use an .xml file as a sample data source. If you don't have an .xml file in your site, you need to create one.

To create a data view by using drag and drop

With your page open in Design view, do one of the following:

  • In the Folder List panel, locate your data source and then drag it onto the page.

    Note

    If your page is an .aspx file, make sure you drop the data source inside the <form> tag.

  • In the Data Source Library panel, locate your data source and then drag it onto the page.

A data view is now displayed on your page, and the Data Source Details panel opens.

Note

When you drag a data source onto a page, the result is a default view of the data with the first five fields in your data source appearing in each row in a basic table. Use the Data Source Details panel to add columns to or remove columns from the data view to best suit your needs.

To create a data view from the Data Source Library panel

  1. Do one of the following:

    • On the Data View menu, click Insert Data View.

    • On the Panels menu, click Data Source Library.

      In either case, the Data Source Library panel opens.

  2. In the Data Source Library panel, locate your data source, click it, and then click Show Data.

  3. In the Data Source Details panel, click the fields that you want to insert in the data view.

    Tip

    To select multiple fields, hold down CTRL while you click them.

  4. Click Insert Selected Fields as, and then click Multiple Item View to insert the selected data into the data view.

    Note

    Single Item View displays a single record in a data view. Multiple Item View displays multiple records, with the fields in columns with headings for each column.

  5. The fields that you selected in the Data Source Details panel now appear in a table.

See also

Tasks

Apply conditional formatting to 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.