Dreamweaver has completed the user's registration, users can now log in to the Web site, to publish notes, notes reply.
7.1 User Logon server behavior
User login, verified correctly, the page changed a user login after the face.
(1) Open the template bkblog.dwt.aspx, insert the table Yhtab in the left column, and design as shown in the black circle in Figure 7-1.
(2) Insert a data set Yhlog about the YH table query to verify that the user is logged on correctly.
① Set the dataset Yhlog as a filter, as shown in Figure 7-2.
Fig. 7-1 The design diagram of the table Yhtab
Figure 7-2 Inserting data set Yhlog
② Click on the "Advanced" button to switch to Advanced dataset mode, as shown in Figure 7-3.
Figure 7-3 Inserting data set Yhlog
③ Click on the parameter "+", pop-up "Edit Parameters" dialog box, fill in the name "@Logpas", type Select "WChar", as shown in Figure 7-4.
Figure 7-4 Add to join Logpass
④ Click the "Build" button, pop-up "Generate Value" dialog box, named "Logpass", the source Select "Form variable", as shown in Figure 7-5.
Figure 7-5 Generate Value dialog box
⑤ Click OK to save the settings and go back to the DataSet Yhlog dialog box. Modify the SQL statement, as shown in Figure 7-6.
Figure 7-6 Modifying the dataset Yhlog
(3) before the
Figure 7-7 Defining a function Uselog
(4) Drag the data set in the template Bkblog.dwt.aspx yhlog the fields below the page yhname to any location, and then drag the field yhid the dataset Yhlog The following code is followed:
<%# Yhlog. Fieldvalue ("Yhname", Container)%><%# Yhlog. Fieldvalue ("Yhid", Container)%>
Change the code above to read:
<%# Uselog (Yhlog. Fieldvalue ("Yhname", Container), Yhlog. Fieldvalue ("Yhid", Container)%>
(5) Insert the data set BJRE on the ZT table query to return the total number of study notes published by the user.
① set the dataset to filter, filter fields: Yhid, and Filter by: Enter a value, as shown in Figure 7-8.
Figure 7-8 Inserting data set Bjre
② Click "Advanced" to switch to advanced dataset mode and modify the SQL as shown in Figure 7-9.
Figure 7-9 Modifying the dataset Bjre
③ Click the "Edit" button to change the Yhid to session ("Useid") in the Text field, as shown in Figure 7-10.
Figure 7-10 Editing the data set Bire parameters
④ Press "OK" and press "OK" to complete the dataset Bire.
(6) Insert the data set PLRE on the HF table query and return the total number of learning notes published by the user. In addition to the query table, the other settings are the same as the DataSet Bjre (you can copy and paste the dataset Plre before you modify it).
(7) Drag the field below the dataset Bjre Eprl100 to "Publish notes:" In the table Yhtab, and drag the fields under the Plre of the dataset Eprl100 to the "Post reply:" In table Yhtab.
(8) before moving the cursor to "user information" in table Yhtab, click "Bind data" under the ASP.net shortcut menu, and the result is shown in Figure 7-11.
Figure 7-11 Inserting bound data
Keep the cursor in the position of the red vertical line in Figure 71, enter: Session ("Usename")
(9) Return to Design view and create a hyperlink to "Publish New Notes" in the form Yhtab:. /ztfb.aspx
To create a hyperlink to "modify material" in the table Yhtab: ... /yhsg.aspx
The result is shown in Figure 7-12.
Figure 7-12 Modification of table Yhtab
(10) Select Table Yhtab, return to Code view, press "Ctrl+x" or select "Cut" from the Edit menu, and paste it into a newly created Notepad or Word document.
(11) Return to Design view, select Table Logtab, and move the cursor to the position of the red vertical line as shown in Figure 7-13.
Figure 7-13 Move to the cursor location
(12) Enter the code as shown in the red circle in Figure 7-14.
Figure 7-14 Inserting the code before the label <form>
(13) After moving the cursor to the YHLOGFRM end tag </form>, enter the code as shown in the red circle in Figure 7-15.
Figure 7-15 Insert code after label </form>
(14) <%end the table cut in step 7th Yhtab to the Code if%> code before <% else%>.
(15) Save the template bkblog.dwt.aspx. Open all Web pages that are based on the bkblog.dwt.aspx template, and copy and paste the newly added dataset in the bkblog.dwt.aspx template Yhlog, Bjre, Plre, respectively, in server behavior. Then insert code like Step 3rd, OK!
(16) Browse the index.aspx in IE browser, the user login is as shown in Figure 7-16, the user log on successfully as shown in Figure 7-17. Remember asp.net is not support gb2312 encoded transmission, to be modified, the previous chapter has said, no longer shiver.
Figure 7-16 before users log on
Figure 7-17 After the user logs in
Reminder: To facilitate the reader to learn, the tutorial is divided into modules to write. In fact, you have to do all the functions in the template at first, especially when the template must be inserted into the dataset and the header loader, because these can not update the Web page after late modification.