Chapter 13. Working with Advanced Pages

Introduction

In addition to typical HTML pages, you can also create other pagesincluding ASP.NET, ASP, PHP, and XMLwhere you can take advantage of other features and technologies that HTML page don’t provide.

Expression Web supports ASP.NET 2.0 and provides controls you can use directly from the Toolbox. The Toolbox in Expression Web provides seven categories of ASP.NET controls: Standard, Data, Validation, Navigation, Login, WebParts, and AJAX Extensions. You can insert ASP.NET controls into an ASP.NET page and configure them in the same way you insert form controls. To use ASP.NET controls, you need to install ASP.NET 2.0 on your Web server and .NET Framework 2.0, 3.0, or 3.5 on your computer, which you can download from www.microsoft.com.

PHP is a server-side scripting language and interpreter used to create dynamic Web pages. A PHP script is embedded in an HTML Web page, and interpreted on the server before being sent to the user who requested the page. The user receives the interpreted PHP code as pure HTML code. PHP runs reliably on almost any platform currently available, including Windows, Linux and Mac servers and clients; it can perform a variety of tasks using module controls, but its strength lies in its compatibility with many types of databases, including MySQL and other SQL or ODBC databases.

XML (eXtensible Markup Language) is designed specifically for Web pages. XML is a complementary format to HTML, which is ideal for producing extensive, highly-structured data from an application in a consistent manner. XML describes the content of a Web page, while HTML tags describe how the page looks. HTML tags assign certain characteristics to the text they surround.

Creating an ASP.NET Page

ASP.NET is the latest dynamic Web site technology from Microsoft. With ASP.NET 2.0, you can display data from a database on a Web page, allow users to create accounts and log in to your Web site, add validation to forms, and add dynamic Web site navigation. ASP.NET is a server technology, so in order to use it, you need to install it on a Web server; check with your administrator or ISP about installing ASP.NET 2.0. You also need to install .NET Framework 2.0, 3.0 or 3.5 (recommended) on your computer, which you can download at www.microsoft.com. You can use the New dialog box to create several different types of ASP.NET pages, including configuration files for .NET 2.0 or 3.5 web application settings.

Create an ASP.NET Page

  1. Create an ASP.NET Page Click the Web Site tab for the site in which you want a new page.

  2. Create an ASP.NET Page Click the New button arrow on the Common toolbar, and then click Page.

  3. Create an ASP.NET Page In the left pane, click ASP.NET.

  4. Create an ASP.NET Page Click the type of ASP.NET page you want.

  5. Create an ASP.NET Page Click OK.

    Create an ASP.NET Page

    An untitled Web page appears.

  6. Create an ASP.NET Page Click the Save button on the Common toolbar, type a name for the page, and then click Save.

Did You Know?

You can test your ASP.NET pages without a Web server. If you don’t have access to a Web server during development, Expression Web provides a MS Expression Development Server so you can test your ASP.NET pages.

See Also

See “Changing Web Site Settings” on page 350 for information on using the MS Expression Development Server.

Using ASP.NET Controls

ASP.NET Controls

Expression Web supports ASP.NET 2.0 and provides controls you can use directly from the Toolbox. You can insert ASP.NET controls into an ASP.NET page and configure them in the same way you insert form controls. To use ASP.NET controls, you need to install ASP.NET 2.0 on your Web server and .NET Framework 2.0, 3.0, or 3.5 on your computer, which you can download from www.microsoft.com. The Toolbox in Expression Web provides seven categories of ASP.NET controls: Standard, Data, Validation, Navigation, Login, WebParts, and AJAX Extensions.

  • Standard. This category provides common controls—Button, CheckBox, DropDownList, and ListBox—as well as uncommon ones—Calendar, AdRotator, and Wizard (to collect data).

  • Data. This category provides controls to create a data-driven Web site for retrieving and displaying data. You can create data connections using the Data Source Library panel. You can connect to data in a database, an XML file, or even a sitemap file.

  • Validation. This category provides controls for configuring form field data validation on an ASP.NET Web form.

  • Navigation. This category provides controls—Menu, SiteMapPath, and TreeView—for navigating in a Web site.

  • Login. This category provides controls for creating a membership login with username and password for an ASP.NET Web site.

  • WebParts. This category provides controls that allow users of the site to customize the appearance and layout of pages. After you insert the WebPartZone control, you can add other individual WebPart controls, which work similar to HTML form pages.

  • AJAX Extensions. This category provides controls for user interface elements—Timer, UpdatePanel, UpdateProgress, ScriptManager, and ScriptManagerProxy.

AJAX Extensions.

Inserting ASP.NET Controls

You can insert ASP.NET controls into a page by using the ASP.NET Controls submenu on the Insert menu or dragging a control from the Toolbox. The ASP.NET Controls submenu provides easy access to commonly used standard controls, while the Toolbox provides access to all the available controls broken down by category, which includes Standard, Data, Validation, Navigation, Login, WebParts, or AJAX Extensions. After you insert an ASP.NET control, you may be prompted with a control menu requesting information or providing options specific to the control. Before you can work with ASP.NET controls, you need to install .NET Framework 2.0, 3.0, or 3.5 (recommended) at www.microsoft.com.

Insert a ASP.NET Controls from the Toolbox Panel

  1. Insert a ASP.NET Controls from the Toolbox Panel Open and display the ASP page you want to use.

  2. Insert a ASP.NET Controls from the Toolbox Panel Expand the ASP.NET Controls category in the Toolbox panel.

  3. Insert a ASP.NET Controls from the Toolbox Panel Expand the category (Standard, Data, Validation, Navigation, Login, WebParts, or AJAX Extensions) in the Toolbox panel with the control you want to insert.

  4. Insert a ASP.NET Controls from the Toolbox Panel Drag control icon to your Web page in Design view where you want to insert it.

    Trouble?

    If the controls are missing in the Toolbox, you need to install .NET Framework 2.0, 3.0, or 3.5 (recommended), which is available at www.microsoft.com.

  5. Trouble? If a control menu appears, click a link to execute the command, or an option to enable it. Link commands and options vary depending on the control.

  6. Trouble? If prompted, specify the options you want, and then click OK.

    Trouble?
  7. Trouble? To change control properties, open the Tag Properties panel, and then specify individual properties.

    Trouble?

Insert Common ASP.NET Controls from the Insert Menu

  1. Insert Common ASP.NET Controls from the Insert Menu Open and display the ASP page you want to use in Design view.

  2. Insert Common ASP.NET Controls from the Insert Menu Click to place the insertion point where you want the control.

  3. Insert Common ASP.NET Controls from the Insert Menu Click the Insert menu, point to ASP.NET Controls, and then select the code script you want:

    • Button. Inserts a button to perform a command.

    • Checkbox. Inserts a check box for users to turn on or off.

    • Checkbox List. Inserts a check box as a parent control.

    • Dropdown List. Inserts a drop-down list box to select an item from a list.

    • Image Button. Inserts a button with an image to perform a command.

    • Label. Inserts a text label.

    • Listbox. Inserts a list box to select one or more items.

    • Radio Button. Inserts an option button to select one or more items.

    • Radio Button List. Inserts a radio button as a parent control.

    • Textbox. Inserts a text box for users to type information.

  4. Textbox. If a control menu appears, click a link to execute the command, or an option to enable it. Link commands and options vary depending on the control.

  5. Textbox. If prompted, specify the options you want, and then click OK.

  6. Textbox. To change control properties, open the Tag Properties panel, and then specify individual properties.???

    Textbox.

Inserting ASP.NET AJAX Controls

ASP.NET AJAX controls provide more response to user actions through partial-page updates (for faster page refreshes and avoid page flicker) and status information without writing scripts. You can insert a ASP.NET AJAX controls into a page by dragging a control from the Toolbox. After you insert an ASP.NET AJAX control, you may be prompted to add a web.config file and turn turn on a visual aid to view a non-visual control. Before you can work with ASP.NET controls, you need to install .NET Framework 3.5 or ASP.NET AJAX 1.0 at www.microsoft.com.

Insert a ASP.NET AJAX Controls from the Toolbox Panel

  1. Insert a ASP.NET AJAX Controls from the Toolbox Panel Open and display the ASP page you want to use.

  2. Insert a ASP.NET AJAX Controls from the Toolbox Panel Expand the ASP.NET Controls category in the Toolbox panel.

  3. Insert a ASP.NET AJAX Controls from the Toolbox Panel Expand the AJAX Extensions category in the Toolbox panel.

  4. Insert a ASP.NET AJAX Controls from the Toolbox Panel Drag control icon to your Web page in Design view where you want to insert it.

    • Script Manager. Manages a client script for AJAX.

    • Script Manager Proxy. Allows content pages and user controls (nested or child elements) to add script and service references to pages, when the ScriptManager is defined in a parent element.

    • Timer. Performs postbacks at defined intervals.

    • Update Panel. Performs a partial-page update.

    • Update Progress. Provides status information on updates.

  5. Update Progress. If prompted to add or update a web.config file, click Yes, or if prompted to turn on a visual aid to view a non-visual control, click Yes.

    Update Progress.
  6. Update Progress. To change control properties, open the Tag Properties panel, and then specify individual properties.

    Update Progress.

Using Custom ASP.NET Controls

If you don’t find the controls you need from the ones provided by .NET Framework, you can use custom ASP.NET controls created by other developers or create your own custom controls by using visual design tool, such as Microsoft Visual Studio. You can view a list of custom ASP.NET controls on the Microsoft ASP.NET Web site at www.asp.net.com under Control Gallery in the Community area. When you place the custom ASP.NET control in the BIN folder of your Web site and reference the custom control, you can take advantage of the added functionality. You can preview custom controls and access the Common Tasks smart tag menu in Design view, edit properties, and use IntelliSense and syntax checking in Code view. The custom controls are not available in the Toolbox or on the Insert menu. Before you can work with ASP.NET controls, you need to install .NET Framework 3.5 at www.microsoft.com.

Use Custom ASP.NET Controls

  1. Use Custom ASP.NET Controls Add the custom control assembly file (.dll) to the bin folder—create one if necessary—in the root folder of your Web site or install the custom control into the Global Assembly Cache (GAC) on both your computer and Web server.

  2. Use Custom ASP.NET Controls Reference the custom control in an ASP.NET page or web.config file.

    • ASP.NET Page. Display page in Code or Split view, and then add the reference code provided in the illustration.

    • web.config file. Open or create a Web site web.config file, and then add the reference code provided in the illustration.

    web.config file.
  3. web.config file. To add a custom ASP.NET control to a page, open and display the page in Code or Split view, place the insertion point in the body, and then type the following code or use the IntelliSense menu:

    <TAG_PREFIX:CLASS_NAME
    runat=server" />

    Replace TAG_PREFIX with the one used in the reference, and replace the CLASS_NAME with the one for the custom control.

Getting Started with PHP

PHP is short for PHP (Personal Homepage): Hypertext Preprocessor. PHP is a server-side, HTML embedded scripting language and interpreter used to create dynamic Web pages. A PHP script is embedded in an HTML Web page, and interpreted on the server before being sent to the user who requested the page. The user receives the interpreted PHP code as pure HTML code. PHP is a collection of modules that can be added on the server as needed to perform a large variety of specific tasks. One of the modules controls database access. Using PHP with MySQL database has become common enough that the MySQL interface is now part of core PHP instead of a plug-in module. PHP can also access most any SQL or ODBC database.

Three things make PHP popular. (1) It’s easy to implement, learn, and use. (2) It’s free. (3) It runs on almost any Web server on almost any platform currently available, including Windows, Linux and Mac servers. PHP is open source, and may be downloaded from www.php.net, and then installed and configured on your Web server.

Getting Started with PHP Code

PHP code is similar to the syntax for C, Perl, and Java, so if you are familiar with any of these scripting language, you have ahead start with PHP. PHP scripts have the extension .php. A PHP script begins with ‘<?php’ and ends with ‘?>’ with PHP code statements in between. When set within a page of HTML, the start and end indicators tell the computer where to differentiate between HTML and PHP. A semicolon at the end of a PHP statement signifies the completion of the line of code. As with HTML, whitespace is ignored between PHP statements. You can also press tab to indent your code and the PHP interpreter will ignore those spaces as well.

Working with Variables

A variable is a means of storing a value, such as text string “Hello!” or the integer value 10, and reusing it throughout your code. In PHP you define a variable with the following form:

$variable_name = Value;

If you forget that dollar sign at the beginning, it will not work. Variable names are case-sensitive, so use the exact same capitalization when using a variable. There are a few rules that you need to follow when choosing a name for your PHP variables. (1) PHP variables must start with a letter or underscore “_”. (2) PHP variables may only be comprised of alpha-numeric characters and underscores. a-z, A-Z, 0-9, or _ . (3) Variables with more than one word should be separated with underscores (for example, $my_variable) or capitalization (for example, $myVariable).

Adding Comments

Comments in PHP are similar to comments that are used in HTML. A single line comment starts with “//” and all text to the right is ignored, while a multiple line comment begins with “/*” and ends with “*/”.

Viewing an Example

The example sends an email from within a PHP page using the built in mail() function:

<?php
// Your email address
$email = "[email protected]";
// The subject
$subject = 'Enter your subject here";
// The message
$message = Enter your message here";
mail ($email, $subject, $message, "From: $email");
// Display text
echo "The email has been sent.";
?>

Creating a PHP Page

With Expression Web, you can create a PHP page in the same you create an HTML page. A PHP page with a script uses the extension .php. The PHP script is embedded in an HTML Web page, and interpreted on the server before being sent to the user who requested the page. The PHP script is enclosed/embedded within special PHP tags (<?php and ?>), which allows the author to jump between HTML and PHP. PHP runs reliably on almost any platform currently available, including Windows, Linux and Mac servers and clients; it can perform a variety of tasks using module controls, but its strength lies in its compatibility with many types of databases, including MySQL and other SQL or ODBC databases.

Create a PHP Page

  1. Create a PHP Page Click the Web Site tab for the site in which you want a new page.

  2. Create a PHP Page Click the New button arrow on the Common toolbar, and then click Page.

    Timesaver

    Click the New button arrow, and then click PHP to create a PHP page.

  3. Timesaver In the left pane, click General.

  4. Timesaver Click PHP.

  5. Timesaver Click OK.

    Timesaver

    An untitled Web page appears.

  6. Timesaver Click the Save button on the Common toolbar, type a name for the page, and then click Save.

    When you have PHP inserted into your HTML and want a Web browser to interpret it correctly, then you must save the file with a .php extension, instead of the standard .html extension, and place the .php file on a PHP enabled (installed and configured) Web server.???

Working with PHP Code

A PHP script begins with ‘<?php’ and ends with ‘?>’. The script that is interpreted on the server into HTML, before being sent to the client. The client will receive a pure HTML page. When set within a page of HTML, these indicators tell the computer where to differentiate between HTML and PHP. The semicolon signifies the end of a PHP statement. As with HTML, whitespace is ignored between PHP statements. You can also press tab to indent your code and the PHP interpreter will ignore those spaces as well. Comments in PHP are similar to comments that are used in HTML. To do a single line comment type “//” and all text to the right will be ignored by PHP interpreter, while the multiple line PHP comment begins with “/*” and ends with “*/”. You can use IntelliSense to help you enter PHP code correctly.

Enter PHP Code Manually

  1. Enter PHP Code Manually Open and display the Web page you want to use.

  2. Enter PHP Code Manually Click the Code or Split button.

  3. Enter PHP Code Manually Click to place the insertion point where you want.

  4. Enter PHP Code Manually Type <?php, and then press Enter.

  5. Enter PHP Code Manually Type the PHP code statements you want followed by the Enter key. Be sure to end a PHP statement with a semicolon.

  6. Enter PHP Code Manually When you’re done entering PHP code statements, press Enter, type ?>, and then press Enter.

    Enter PHP Code Manually

See Also

See “Getting Start with PHP” on page 322 for information on using PHP code.

See “Setting Code Formatting Options” on page 374 for information on changing the color of PHP code.

Use IntelliSense to Enter PHP Code

  1. Use IntelliSense to Enter PHP Code Open and display a PHP page you want to use.

  2. Use IntelliSense to Enter PHP Code Click the Code or Split button, and then click to place the insertion point between the PHP script block start and end tags (<? and ?>).

  3. Use IntelliSense to Enter PHP Code Click the Edit menu, point to IntelliSense, and then click List Members to insert a function, or type $_ to insert a PHP variable.

  4. Use IntelliSense to Enter PHP Code Type part of the item name or move down the IntelliSense shortcut menu list, and then press either Tab or Enter for the selected item or double-click the item to insert it in the code.

    Use IntelliSense to Enter PHP Code
  5. Use IntelliSense to Enter PHP Code To display a tooltip with PHP function parameters, press Shift+ Ctrl+Spacebar.

Set PHP IntelliSense Options

  1. Set PHP IntelliSense Options Click the Tools menu, and then click Page Editor Options.

  2. Set PHP IntelliSense Options Click the IntelliSense tab.

  3. Set PHP IntelliSense Options Select the PHP global variable completion check box to have IntelliSense complete global variables.

  4. Set PHP IntelliSense Options Select the PHP parameter information check box to have IntelliSense provide parameter information.

  5. Set PHP IntelliSense Options Select the check boxes next to the PHP function categories you want to use with IntelliSense.

  6. Set PHP IntelliSense Options Click OK.

    Set PHP IntelliSense Options

Inserting a PHP Script

A PHP script begins with ‘<?php’ and ends with ‘?>’. Instead of manually typing the beginning and ending code before you type a PHP statement, you can quickly insert commonly used PHP code snippets that includes them into your page. You can insert a PHP code snippet by using the PHP submenu on the Insert menu. When you insert a code snippet, the code appears all on one line. The code line starts with <?php followed by the PHP code statement, and then ends with ?> all separated by spaces. If you want, you can separate the three parts into individual lines of code.

Insert a PHP Script

  1. Insert a PHP Script Open and display the Web page you want to use.

  2. Insert a PHP Script Click the Code or Split button.

  3. Insert a PHP Script Click to place the insertion point where you want.

  4. Insert a PHP Script Click the Insert menu, point to PHP, and then select the code script you want:

    • Form Variable. Use to collect information from a form when using the HTTP post method.

      <?php $_POST[]; ?>

    • URL Variable. Use to collect information from a form when using the HTTP get method.

      <?php $_GET[]; ?>

    • Session Variable. Use to save information about a user’s session time at your site.

      <?php $_SESSION[]; ?>

    • Cookie Variable. Use to retrieve a cookie value from a user’s computer. A cookie is a file that is embedded in the user’s computer by the server in order to identify it.

      <?php $_COOKIE[]; ?>

    • Include. Use to insert a file and doesn’t require a successful script. In the dialog box, select a file, and then click Open.

      <?php include(); ?>
      <?php include_once(); ?>

    • Require. Use to insert a file and does require a successful script. In the dialog box, select a file, and then click Open.

      <?php require(); ?>
      <?php require_once(); ?>

    • Code Block. Use to insert the beginning <?php and ending ?> PHP code.

      <?php ?>

    • Echo. Use to display HTML in your browser.

      <?php echo ?>

    • Comment. Use to insert a multiple-line comment.

      /* */

    • If. Use to check whether a condition is true.

      <?php if ?>

    • Else. Use as an option when an if statement is false.???

      <?php else ?>

    Figure . 

  5. If desired, you can separate the three parts into individual lines of code.

Did You Know?

You can show or hide PHP formatting marks in Design view. In Design view, click the View menu, point to Formatting Marks, and then click Show. Click the View menu, point to Formatting Marks, and then click Script Block.

Creating an XML Page

XML is short for Extensible Markup Language. XML is designed specifically for Web pages. XML is a complementary yet stricter format to HTML. XML is ideal for producing extensive, highly-structured data from an application in a consistent manner. The difference between XML and HTML is subtle but profound: XML describes the content of a Web page, while HTML tags describe how the page looks. HTML tags assign certain characteristics to the text they surround. XML is ideal for data-intensive Web environments and, unlike HTML, supports customized tags for specific data. After you create an XML page with the customized, you can use the XML file in HTML and ASP.NET pages to create Data Views that integrate XML data.

Create an XML Page

  1. Create an XML Page Click the Web Site tab for the site in which you want a new page.

  2. Create an XML Page Click the New button arrow on the Common toolbar, and then click Page.

  3. Create an XML Page In the left pane, click General.

  4. Create an XML Page Click XML.

  5. Create an XML Page Click OK.

    Create an XML Page

    An untitled Web page appears.

  6. Create an XML Page Click the Save button on the Common toolbar, type a name for the page, and then click Save.

Did You Know?

You can change the XML encoding. Open the Web site with the XML page you want to change, right-click the XML page in the editor, and then click Encoding. To reload the file, click a different encoding, and then click Reload. To save the file, click the encoding you want, click Save As, and then save the file.

Creating a Data View

A Data View retrieves data from a data source with XML and displays the data using XSLT (eXtensible Stylesheet Language Transformation) formatting. You can create Data Views to integrate XML data in HTML and ASP.NET pages by simply dragging an XML file onto your page. However, the code generated in HTML and ASP.NET is different. When you create a Data View in HTML, Expression Web adds an IFRAME element to your page and creates a JavaScript file to run the IFRAME element and an XSLT file to provide formatting. In ASP.NET, Expression Web adds an ASP XML control to your page, sets control properties, and creates an XSLT file. A Data View is a live, customizable view of an XML data source that you can sort, filter, or group.

Create a Data View

  1. Create a Data View Open and display the HTML or ASP.NET page where you want to create a Data View in Design view.

  2. Create a Data View To create a Data View with all XML data, drag the XML file onto your Web page from the Folder List panel or the Data Source Source Library panel.

  3. Create a Data View To create a Data View with selected XML data, do the following:

    • Click the Data View menu, and then click Insert Data View.

    • In the Data Source Library panel, select the XML data file, and then click Show Data.

    • In the Data Source Details panel, select the fields you want to insert in the Data View.

    • Click Insert Selected Fields as, and then click Single Item View or Multiple Item View to insert the data.

    The data appears in a basic table layout, but you can change it later.

  4. Create a Data View Place the insertion pointer in the table cells to edit the data; use the Delete submenu on the Table menu to remove elements.

    Create a Data View
  5. Create a Data View Click the Save button on the Common toolbar, and then click OK to save the embedded file.

    Create a Data View

Working with Data in Data View

In a Data View, you can add, remove, or arrange columns, which displays data fields. After you display and position columns in Data View, you can sort and filter the data to display the information you want in the most effective way that works for you. A sort arranges all the data in a Data View by a field. You can sort by one or more fields in ascending (A to B or 1, 2, 3) or descending order (Z to A or 3, 2, 1). A filter displays data in a Data View by a field based on rules. A filter is built upon one or more expression rules, known as clauses, that get applied to the data. If the data meets the expression clauses, the data appears in Data View.

Modify the Columns in a Data View

  1. Modify the Columns in a Data View Open and display the HTML or ASP.NET page with a Data View.

  2. Modify the Columns in a Data View In Design view, select the Data View you want to change.

  3. Modify the Columns in a Data View Click the Data View menu or Data View Tasks arrow, and then click Edit Columns.

    Modify the Columns in a Data View
  4. Modify the Columns in a Data View To add a column, click the field you want to include, and then click Add.

  5. Modify the Columns in a Data View To remove a column, click the field you want to delete, and then click Remove.

  6. Modify the Columns in a Data View To arrange columns, click the field you want to move, and then click Move Up or Move Down.

  7. Modify the Columns in a Data View Click OK.

    Modify the Columns in a Data View

Did You Know?

You can edit the data in Data View. In Expression Web, click in the xml table in Data View, and then edit the data. Editing changes in one field affect all cells. In the xml file or data source, click in the data fields, edit the data, and then export or save it.

Sort Data in a Data View

  1. Sort Data in a Data View Open and display the HTML or ASP.NET page with a Data View.

  2. Sort Data in a Data View In Design view, select the Data View you want to change.

  3. Sort Data in a Data View Click the Data View menu or Data View Tasks arrow, and then click Sort.

    Sort Data in a Data View
  4. Sort Data in a Data View Click the field you want to sort on, and then click Add.

  5. Sort Data in a Data View Click the Ascending or Descending option.

  6. Sort Data in a Data View To sort on multiple fields, add more fields to the Sort Order list, and then click Move Up or Move Down to change the sort order.

  7. Sort Data in a Data View Click OK.

    Sort Data in a Data View

Filter Data in a Data View

  1. Filter Data in a Data View Open and display the HTML or ASP.NET page with the Data View.

  2. Filter Data in a Data View In Design view, select the Data View you want to change.

  3. Filter Data in a Data View Click the Data View menu or Data View Tasks arrow, and then click Filter.

    Filter Data in a Data View
  4. Filter Data in a Data View Click Click here to add a new clause.

  5. Filter Data in a Data View Click the Field Name, Comparison, and Value boxes, and then specify the values or operator you want.

  6. Filter Data in a Data View To add to a clause, click the And/Or box, click And or Or, and then repeat Steps 4 and 5.

  7. Filter Data in a Data View To delete a clause, click the clause column arrow, and then press Delete.

  8. Filter Data in a Data View Click OK.

    Filter Data in a Data View

Formatting Data in a Data View

When you create a Data View, the data appears in a basic table layout. You can use formatting tools to manually change different aspects of the layout or apply one of the built-in layouts in Expression Web. If you use a built-in layout that displays fewer fields than your original Data View, those fields are removed from your Data View. In addition, any previous layout formatting is removed. If you want to manually format a Data View, you can change font formatting and color using tools on the toolbar, and apply styles and conditional formatting. When you change a data element in one field, the same data element change is applied to all the fields. As you format a Data View, Expression Web creates and modifies an external XSLT file.

Change the Layout of a Data View

  1. Change the Layout of a Data View Open and display the HTML or ASP.NET page with a Data View.

  2. Change the Layout of a Data View In Design view, select the Data View you want to change.

  3. Change the Layout of a Data View Click the Data View menu or Data View Tasks arrow, and then click Change Layout.

  4. Change the Layout of a Data View Select the layout style you want.

  5. Change the Layout of a Data View Click OK.

    Change the Layout of a Data View
  6. Change the Layout of a Data View Click Yes or No to remove any previous custom formatting.

  7. Change the Layout of a Data View In Data View, edit or delete the data, and drag fields to add (from the Data Source Details panel) or move them.

    Change the Layout of a Data View

Did You Know?

You can manually format elements in Data View. In Design view, select the data in the Data View you want to format, and then click buttons on the Formatting toolbar to change font style, size, and color, and align text. You can also use the Apply Style panel to apply formatting styles to data. When you change a data element in one field, the same data element change is applied to all the fields.

Apply Conditional Formatting to a Data View

  1. Apply Conditional Formatting to a Data View Open and display the HTML or ASP.NET page with a Data View.

  2. Apply Conditional Formatting to a Data View In Design view, select the Data View you want to format.

  3. Apply Conditional Formatting to a Data View Click the Data View menu or Data View Tasks arrow, and then click Conditional Formatting.

  4. Apply Conditional Formatting to a Data View In Data View, select any cell, except for the header cell, such as the HTML tag, data value, or range of text.

    Timesaver

    Right-click inside a cell, point to Select, and then click Cell.

  5. Timesaver Click Create, and then click Apply Formatting.

    Timesaver
  6. Timesaver Click anywhere in the first row to add a new clause.

  7. Timesaver Click the Field Name, Comparison, and Value (and More Fields) arrows, and then specify the field, value, or comparison operator you want for the rules to apply the formatting.

  8. Timesaver Click OK.

    Timesaver
  9. Timesaver Specify the formatting to apply when the conditions are met.

  10. Timesaver Click OK.

    Timesaver

Did You Know?

You can change the data format type. In Design view, select the data in the Data View you want to format, click the Data View menu, point to Format Item as, and then click a formatting option: Text, Boolean, Number, Hyperlink, or Picture.

Checking XML Pages

When you create and work with an XML file, you need to make sure the XML code are written and formed correctly. The standards for XML tags and related attributes are stricter than those for HTML, so it’s important that you check the file; otherwise, the file will not display correctly. For example, so much as a single missing tag or mis-formatted attributes makes the entire file unreadable.

Check for Well-Formed XML

  1. Check for Well-Formed XML Open the Web site with XML page you want to check.

  2. Check for Well-Formed XML Right-click the XML page in the editor, and then click Verify well-formed XML.

    If an error appears, the XML Validation dialog box appears, displaying a description of the error, and the line number of the error.

  3. Check for Well-Formed XML To display the error, click Go To Error.

    Check for Well-Formed XML
  4. Check for Well-Formed XML Make the changes to fix the error.

    Check for Well-Formed XML
  5. Check for Well-Formed XML Click the Save button on the Common toolbar to save the file; if prompted, click Yes to confirm the save.

    Check for Well-Formed XML

Did You Know?

You can reformat XML for easier editing. Open the Web site with the XML page you want to reformat, right-click the XML page in the editor, and then click Reformat XML.

Apply XML Formatting

  1. Apply XML Formatting Open the Web site and page you want to apply XML formatting.

  2. Apply XML Formatting Click the Code or Split button at the bottom of the window.

  3. Apply XML Formatting Right-click anywhere on the page, and then click Apply XML Formatting Rules.

    Apply XML Formatting

    Expression Web scans the XML code for missing or incomplete tags.

See Also

See “Creating an XML Page” on page 334 for information on creating an XML page.

Adding RSS Feeds

An RSS (Really Simple Syndication) feed provides a way for Internet content publishers to make news, blogs, and other content available to subscribers in an standardized XML format. You can integrate RSS feeds in your Web pages. An RSS feed is an XML file that gets updated with new information. To add a local RSS feed to a Web page, add the XML file to the Data Source Library panel, and then add the data from the XML file to your Web page, which creates a Data View.

Add RSS Feeds

  1. Add RSS Feeds Open the Web site and Web page you want to add a RSS feed.

  2. Add RSS Feeds If the XML file isn’t in your Web site, do the following:

    • Click the Panels menu, and then click Data Source Library.

    • Under Local XML Files, click the Add an XML file link.

    • Browse to and select the XML file, and then click OK.

    Add RSS Feeds
  3. Add RSS Feeds Use either of the following to add the XML data to a page:

    • All Data. Drag the XML file from the Data Source Library panel into the RSS Web page in Design view.

    • Selected Data. Place the cursor where you want to place the selected data in Design view, click the XML file, and then click Show Data. In the Data Source Details panel, Ctrl+click to select the fields you want in the RSS Web page. Click Insert Selected Fields as and then click Single Item View to insert the RSS feed as a new Data View in the page.

    Selected Data.

See Also

See “Creating a Data View” on page 329 for information on using XML files to create a RSS feed in a Data View.

Creating an ASP Page

ASP (Active Server Pages) is a technology that allows you to make dynamic and interactive Web pages. ASP uses server-side scripting to dynamically create Web pages that are not effected by the type of browser a person uses to view the page. The default scripting language used for writing ASP is VBScript, although you can also use JScript (Microsoft’s version of JavaScript). All the ASP code is run on the Web server and no ASP is passed to the browser. ASP runs on a Web server that uses Microsoft’s Internet Information Services (IIS) (recommended) or Personal Web Server (PWS), which comes free with Windows. ASP pages use the .asp extension. You can create an ASP Web page (New!) in Expression Web for compatibility purposes. ASP has been superseded by ASP.NET.

Create an ASP Page

  1. Create an ASP Page Click the Web Site tab for the site in which you want a new page.

  2. Create an ASP Page Click the New button arrow on the Common toolbar, and then click Page.

  3. Create an ASP Page In the left pane, click General.

  4. Create an ASP Page Click ASP.

  5. Create an ASP Page Click OK.

    Create an ASP Page

    An untitled Web page appears.

  6. Create an ASP Page Click the Save button on the Common toolbar, type a name for the page, and then click Save.

    Create an ASP Page

 

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

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