Completing the update page block by block (ASP.NET)

Completing the update page block by block (ASP.NET)

An update page has three building blocks:

  • A filtered DataSet to retrieve the record from a database table (see Retrieving the record to update (ASP.NET))
  • An HTML form to let users modify the record’s data
  • An Update Record server behavior to update the database table

You can add the final two basic building blocks of an update page separately using the form tools and the Server Behaviors panel.

Before you can add the building blocks, your web application must be able to identify the record to update, and your update page must be able to retrieve it. See Searching for the record to update (ASP.NET), Opening the update page and passing the record ID (ASP.NET), and Retrieving the record to update (ASP.NET).

Completing the update page consists of three tasks:

  • Adding an HTML form to the page to let users modify the data
  • Displaying the record in the form by binding the form objects to database table columns
  • Adding the Update Record server behavior to update the database table after the user modifies the record

To add an HTML form to an update page:

  1. Create a new ASP.NET page.

    This will become your update page.

  2. Lay out your page using the Dreamweaver design tools.
  3. Add an HTML form by placing the insertion point where you want the form to appear and selecting Form from the Insert menu.

    An empty form is created on the page. You may have to enable Invisible Elements (View > Visual Aids > Invisible Elements) to see the form’s boundaries, which are represented by thin red lines.

  4. Name the HTML form by clicking the <form> tag at the bottom of the Document window to select the form, opening the Property inspector (Window > Properties), and entering a name in the Form Name box.

    You don’t have to specify an action or method attribute for the form to tell it where and how to send the record data when the user clicks the Submit button. The Update Record server behavior sets these attributes for you.

  5. Add a form object such as a text field (Insert > Form > Text Field) for each column you want to update in the database table.

    The form objects let users modify the data. Text fields are common for this purpose, but you can also use list/menus, checkboxes, and radio buttons.

    Each form object should have a corresponding column in the DataSet you defined earlier. The only exception is the unique key column, which should have no corresponding form object.

    For more information on form objects, see Inserting HTML form objects.

  6. Add a Submit button to the form (Insert > Form > Button).

    You can change the label of the Submit button by selecting the button, opening the Property inspector (Window > Properties), and entering a new value in the Label text box.

To display the record in the form:

  1. Make sure you defined a DataSet to hold the record the user wants to update.

    For more information, see Retrieving the record to update (ASP.NET).

  2. Bind each form object to data in the recordset.

    For more information, see the following sections:

    • Displaying dynamic content in HTML text fields
    • Dynamically preselecting HTML checkboxes
    • Dynamically preselecting HTML radio buttons
    • Creating a dynamic HTML form menu
    • Making existing HTML form menus dynamic

To add a server behavior to update the database table:

  1. In the Server Behaviors panel (Window > Server Behaviors), click the Plus (+) button and select Update Record from the pop-up menu.

    The Update Record dialog box appears.

  2. Complete the dialog box.

    For instructions, see Setting the Update Record dialog box options (ASP.NET).

  3. Click OK.

Dreamweaver adds a server behavior to the page that lets users update records in a database by clicking the Submit button on the form.

To edit the server behavior, open the Server Behaviors panel (Window > Server Behaviors) and double-click the Update Record behavior.

Related topics

  • Completing the update page in one operation (ASP.NET)


Getting Started with Dreamweaver
Dreamweaver Basics
Working with Dreamweaver Sites
Laying Out Pages
Adding Content to Pages
Working with Page Code
Preparing to Build Dynamic Sites
Making Pages Dynamic
Developing Applications Rapidly
Building ColdFusion Applications Rapidly
Building ASP.NET Applications Rapidly
Reference
Building ASP and JSP Applications Rapidly