Dreamwaver mx and asp.net (vi)

Source: Internet
Author: User
Tags filter format insert key modify net query dreamweaver
asp.net 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:

< Mm:update

runat= "Server"

Commandtext= ' <% # ' UPDATE locations SET city=?, state_country=?, fax=?, telephone=?, address=? WHERE code=? "% > '

Connectionstring= ' <% # System.Configuration.ConfigurationSettings.AppSettings ("Mm_connection_string_location" )% > '

Databasetype= ' <% # System.Configuration.ConfigurationSettings.AppSettings ("Mm_connection_databasetype_ Location ")% > '

Expression= ' <% # Request.Form ("mm_update") = "Form1"% > '

Createdataset= "false"

Successurl= ' <% # "location3.aspx"% > '

Debug= "true"

>

< Parameters >

< Parameter name= "@CITY" value= ' <% # IIf (Request.Form ("City") < > No), Request.Form ("City"), "")% > ' Type= "WChar"/>

< Parameter name= "@STATE_COUNTRY" value= ' <% # IIf (Request.Form ("state") < > No), Request.Form ("state" ), "" "% > ' type=" WChar "/>

< Parameter name= "@FAX" value= ' <% # IIf (request.form ("fax") < > Nothing), Request.Form ("fax"), "")% > ' Ty Pe= "WChar"/>

< Parameter name= "@TELEPHONE" value= ' <% # IIf (Request.Form ("Tele") < > Nothing), Request.Form ("Tele"), "")% > ' type= WChar '/>

< Parameter name= "@ADDRESS" value= ' <% # IIf (Request.Form ("Address" < > No), Request.Form ("address"), "")% > ' type= "WChar"/>

< Parameter name= "@CODE" value= ' <% # IIf (Request.Form ("HiddenField") < > Nothing), Request.Form (" HiddenField ")," ")% > ' type=" WChar "/>

</parameters >

</mm:update >

The Dreamweaver MX is mm:update to form the updated code. The format is similar to that of Mm:insert.

Related Article

Contact Us

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: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.