Developer on Alibaba Coud: Build your first app with APIs, SDKs, and tutorials on the Alibaba Cloud. Read more ＞
6. Create a record modification page
Related Introduction (note: In order to be able to display code, all the following code in the "<" and ">" before adding a space, inconvenience please forgive! ):
Adding, modifying, and deleting data is three basic operations on the database. This section describes the section on modifying records.
Step 1 Design modification Process
In general, you only need to update the specified records, so you need to create a search page to query, display the results of the query on the results page, and have the user modify it. Finally, the update task is completed by submitting the operation.
First, create a query page. In the process of establishing a dataset, we can select the data we want through the data filter filter. Since we will be clicking on the link in DataList to reach this page, select the URL parameter and use the keyword code to filter out the desired page.
[Figure 6-1 Filtering data]
To do this, create a new modify.aspx file in the site and add the dataset as shown above.
STEP2 Create Detail Page
To create a link, you should first create a navigation page. You can achieve this navigation effect on the DataGrid page modifications that are created in section 3rd. The style of the DataGrid is modified, and the data items can also be set to display the linked text. The same function can also be achieved in DataList and Repeater, which is to set up a super link to the detail page.
Open the original location2.aspx file and modify the original DataList style. Select Datalistm Click Edit Columns (Figure 6-2). In the DataGrid Style Design dialog box (Figure 6-3) that pops up, you can set the Location_name type to hyperlink. Select Location_name, and click the Change Column Type button to be changed to hyperlink.
[Figure 6-2 Edit Columns ...]
[Figure 6-3 Setting hyperlink]
For hyperlink, set the following figure,
[Figure 6-4 Setting link keywords]
The data field displayed is Location_name, the connection keyword is code, the page that needs to jump to is modify.aspx page. Click on the link after the specific URL will be for
Http://yoursite/modify.aspx?CODE= the value of the CODE of the record clicked
The Modify.aspx page will also query the required records from the database by the value of the code that came through.
To update the data in the Modify.aspx page, you need to use the form. This requires binding the data records and the input boxes. The way in which data is bound in Dreamweaver MX is similar to that of Dreamweaver Ultradev. Set the page as Figure 6-5. Create a new 6 text field,1 a hiddenfield,1 submit button and put it in the appropriate position. Where Hiddernfield is used to hold the code value for this record. Because the code value is a keyword, you do not need to change it.
[Figure 6-5 modify.aspx page]
Click the Binding tab to drag the specific data item to the corresponding text field. You can also set the display type of the data in format. You can also bind all the properties of the text field to the data source. Select the first drop-down for a record
[Figure 6-6 Binding] [Figure 6-7 Data type selection] [Figure 6-8 Binding Properties]
List that sets the Text field property that is bound by the data source.
Step 3 Data Update
For data updates, click the "+" button in the server behaviors in the application panel to select the update record.
[Figure 6-9 Select Update Record]
[Figure 6-10 Setting Association]
In the pop-up dialog box, you associate the input box with the data source that should be updated, and set the data type. Where code should be the key word that is primary key. A page similar to an Insert record, and a page that successfully adds and adds a failure jump to.
Now you can preview a good page. Enter the URL http://yoursite/location3.aspx, you can see the page as shown in Figure 6-11.
[Figure 6-11 location3.aspx Page view]
One of the location_name is clickable and will jump to the details page modify.aspx.
[Figure 6-12 Update page Preview]
You can modify existing data by modify.aspx the page, and you can update the data with form submission events.
The main code for the update is as follows:
Commandtext= ' <% # ' UPDATE locations SET city=?, state_country=?, fax=?, telephone=?, address=? WHERE code=? "% > '
The Dreamweaver MX is mm:update to form the updated code. The format is similar to that of Mm:insert.
This article is an English version of an article which is originally in the Chinese language on aliyun.com and is provided for information purposes only. This website makes no representation or warranty of any kind, either expressed or implied, as to the accuracy, completeness ownership or
reliability of the article or any translations thereof. If you have any concerns or complaints relating to the article, please send an email, providing a detailed description of the concern or
complaint, to firstname.lastname@example.org. A staff member will contact you within 5 working days. Once verified, infringing content will be removed immediately.
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
and provide relevant evidence. A staff member will contact you within 5 working days.