Dreamweaver Build Blog (7): implementation of User Login 2

Source: Internet
Author: User
Tags add date empty insert integer modify window dreamweaver
Dreamweaver

7.2 Users Post response information

Once the user is logged in, they can post a response message to each learning note.

(1) Open hf.aspx, insert form YHPLFRM, insert table Hftab, Insert server text box control in table, ID is hfname, insert server Text area control, ID is hftext, insert Publish button, ID is plbottom, set it to Disabled , the results are shown in Figure 7-18.

Fig. 7-18 Related design of table Hftab

(3) The Binding Data session ("Usename") to the "name:" In the table Hftab (method such as the user name before the "user information" is bound by the 7.1 Step 8 procedure).

(4) Drag the data set ztre the field ztname to the text box Hfname, in the Text box Hfname Properties window, the initial value:

<%# ztre.fieldvalue ("Ztname", Container)%>

To

<%# "RE:" &ztre.fieldvalue ("Ztname", Container)%>

(5) Select the button Plbottom, right-click the status bar < input # Plbottom>, and select Edit Label from the pop-up shortcut menu, as shown in Figure 7-19.

Figure 7-19 Selection < input # plbottom> quick edit tab

(6) In the pop-up < input # plbottom> Quick Edit tag:

Disabled= "true"

To

disabled=<%# IIF (Session ("Usename") <>nothing), false,true)%>

The result is shown in Figure 7-20.

Figure 7-20 Quick < input # plbottom> edit tags

The button Plbottom, which is disabled before the user logs on, is available after the user logs in.

(4) Add Insert record server behavior, submit value from form YHPLFRM, select Insert Table as HF, and other settings as shown in Figure 7-21.

Figure 7-21 Adding insert record server behavior

In Figure 7-21, you can see that the fields Hfid, Hftime, Yhid, Ztid do not get the values. The field Hfid is automatically numbered, the database automatically adds a value to the record, and the field hftime the default value in Access is date (), so the database automatically adds the day date to the newly added record. The field Yhid is the ID code of the logged-in user, and the field Ztid is the note ID to be published. So to add the ID code of the Logged-on user to the field Yhid, the note ID code to be published is added to the field Ztid.
(5) Go back to Code view and find the code for the Insert record (DKCONN,HF), as shown in Figure 7-22 Black selected section.

Figure 7-22 Finding the code for the Insert record (DKCONN,HF)

(6) The code:

commandtext= ' <%# ' INSERT into HF (Hfname, Hftext) VALUES (?,?,) "%>"

To

commandtext= ' <%# ' INSERT into HF (Hfname, Hftext, Ztid, Yhid) VALUES (?,?,?,?) "%>"

(7) Add parameters in sequence:

<parameter name= "@ZTID" Value= ' <%# ztre.fieldvalue ("Ztid", Container)%> ' type= ' "Integer"/>

<parameter name= "@YHID" Value= ' <%# session ("Useid")%> ' type= ' Integer '/>

The result is shown in Figure 7-23.

Figure 7-23 Modified results of the Insert record (DKCONN,HF) code

(8) Before the release of the reply message, the reply title and the content of the reply should be validated to prevent the release of empty headers or empty content of the reply information. Add the Requiredfieldvalidato validation control to the text box hfname, text area control Hftext, respectively, by inserting the Requiredfieldvalidato validation control method in Section 6.2.

(9) When the user publishes the reply information, also must give the study note the total number of replies automatically increases 1, namely gives the ZT table the Hfzs field automatically increases 1.

① in the Server Behaviors panel, insert the update record server behavior, set up the Update table for ZT, temporarily set the submission value, from the form YHPLFRM, temporarily set: ' Hfzs ' from ' hftext ' to get the value (as ' Integer '); temporarily set: ' Ztid ' will ' Hftext ' Use as ' Integer ' to select records

Why is the ② all temporary? That is to let Dreamweaver automatically generate some code, after easy to modify. Switch code view first, find the original code for the update record (DKCONN,ZT), and find the code:

<parameter name= "@HFZS" Value= ' <%# IIf (Request.Form ("Hftext") <> Nothing), Request.Form ("Hftext"), "" "% > ' type= ' Integer '/>

<parameter name= "@ZTID" Value= ' <%# IIf (Request.Form ("Hftext") <> Nothing), Request.Form ("Hftext"), "" "% > ' type= ' Integer '/>

Change it to:

<parameter name= "@HFZS" Value= ' <%# ztre.fieldvalue ("Hfzs", Container) +1%> ' type= ' Integer '/>

<parameter name= "@ZTID" Value= ' <%# session ("ZTANW")%> ' type= ' Integer '/>

(10) Save hf.aspx.

7.3 Users published Learning notes

After the user log in, in addition to can post the reply information, but also may publish the new study note.

(1) Create a Dynamic Web page ztfb.aspx by the template bkblog.dwt.aspx, insert a list of five elements in the mainbody editable region ZTFB.

(2) Add DataSet ZTHB, set Filter to Yhid, and set parameter as phase variable usename, its design is shown in Figure 7-24.

Figure 7-24 Adding data set ZTHB

(3) Drag the relevant field under the DataSet to the table ZTFB, by referring to the method in section 4.2.

(4) Open the Hf.aspx, copy the form yhplfrm, paste it into the page ztfb.aspx in the table ZTHB the fifth row, empty the text box hfname, and make the necessary changes, the results shown in Figure 7-25.

Fig. 7-25 Design of Table ZTFB

(2) renamed the text box Hfname as Ztname, and the text area Hftext renamed Zttext.

(3) Set the repeating region of the tertiary behavior DataSet ZTHB the table ZTHB, and insert the dataset navigation in the fourth row of the table.

(4) Insert list/menu Lmid, click the list value in its Properties window, in the Pop-up List Value dialog box, enter item label as: Design item, value is: 1, press "OK" key, as shown in Figure 7-26.

Figure 7-26 Lmid List Value dialog box

(5) Keep list/menu lmidl in the selection, switch to Code view, find the list/menu Lmid The original code, drag the DataSet Menuda the field Lmid, replace the value equals number 1, as shown in Figure 7-27.

Figure 7-27 dragging a field under the Menuda of a dataset Lmid

(6) Drag the field LM under the DataSet Menuda, replacing the design item, as shown in Figure 7-28.

Figure 7-28 dragging the field LM under the Menuda of the dataset

(7) Select the code in the red circle of the figure 7-3-5 and define it as a repeating region of the DataSet Menuda, as shown in Figure 7-29.

Figure 7-29 Defining a dataset in a list Menuda a repeating region
(8) Add the Insert record server behavior, which is set as shown in Figure 7-30.

Figure 7-30 Adding the Insert record server behavior

(9) Switch to Code view, find the inserted record (DKCONN,ZT) of the original code, find the code:

commandtext= ' <%# ' INSERT into ZT (Lmid, Ztname, Zytext) VALUES (?,?,?) "%>"

To

commandtext= ' <%# ' INSERT into ZT (Lmid, Ztname, Zytext,yhid) VALUES (?,?,?,?) "%>"

(10) Add Parameters:

<parameter name= "@YHID" Value= ' <%# session ("Useid")%> ' type= ' Integer '/>

The result is shown in Figure 7-31.

Figure 7-31 Insert Record (DKCONN,ZT) modified original code

7.4 Modify user Information

Modify user Information page design and user Registration page design is basically the same.

(1) Open the registration page yhlogok.aspx, save it as yhsg.aspx, and make appropriate changes, as shown in Figure 7-32.

Figure 7-32 yhsg.aspx Page Design

(2) Delete the Insert record (DKCONN,YH) server behavior and add the DataSet YHSG, as shown in Figure 7-33.

Figure 7-33 Inserting data set YHSG

(3) The relevant fields under the bound dataset YHSG to the corresponding text boxes, as shown in Figure 7-34.

Figure 7-34 Binding dynamic text to the text box

(4) Add update record server behavior, temporarily set: ' Yhid ' use ' yhname ' as ' Integer ' to select records, the result is shown in Figure 7-35.

Figure 7-35 Adding more logging server behavior

(5) in the more recorded source code, locate the code:

<parameter name= "@YHID" Value= ' <%# IIf (Request.Form ("Yhname") <> Nothing), Request.Form ("Yhname"), "" "% > ' type= ' Integer '/>

Change it to read:

<parameter name= "@YHID" Value= ' <%# IIf ((Not session ("Useid") are nothing), session ("Useid"), "" "%>" type= " Integer "/>

(6) Save yhsg.aspx.



Related Article

Alibaba Cloud 10 Year Anniversary

With You, We are Shaping a Digital World, 2009-2019

Learn more >

Apsara Conference 2019

The Rise of Data Intelligence, September 25th - 27th, Hangzhou, China

Learn more >

Alibaba Cloud Free Trial

Learn and experience the power of Alibaba Cloud with a free trial worth $300-1200 USD

Learn more >

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.