Dreamweaver Construction Blog Full record (6)-The implementation of user registration

Source: Internet
Author: User
Tags add filter expression insert net first row variable dreamweaver
dreamweaver| User Registration

Sixth chapter doking ' s Blog User Registration page implementation

Some people find out: Where does the user go to write notes and reply? This is the problem that the sixth to seventh chapter will solve. This chapter mainly explains the implementation of user registration page.

6.1 Basic Page Design

  6.1.1 Template bkblog.dwt.aspx Page modification

(1) Open the template bkblog.dwt.aspx, insert the table Lefttab in the left column, insert the form yhlogfrm in the first row, insert the table Logtab in the form YHLOGFRM, insert the relevant text box, text area, and button, and the result is as shown in Figure 6-1-1:

Figure 6-1-1 User Login Design in template

(2) Name the corresponding text box of the author as logname; name the corresponding text box for the password as Logpass, the type to password, and the "Register" button to "none" and change the "login" button to "submit the form".

(3) Select button "Register" button, in the "Behavior" panel, add behavior to the URL, in the pop-up dialog box, enter the link to "... /yhinlog.aspx "as shown in Figure 6-1-2:

Figure 6-1-2 Add a go to URL behavior

(4) Save the template and update all the pages.

  Design of 6.1.2 Registration page

(1) New asp.net VB generated by template bkblog.dwt.aspx Dynamic page yhinlog.aspx, insert the form yhinfrm in the mainbody editable region, insert the table Yhinlog, and design the results as shown in Figure 6-1-3:

Figure 6-1-3 design of table Yhinlog

(2) Select the text box corresponding to the user name, switch to the label panel, expand css/Accessibility, enter Yhname in ID, expand Unclassified, enter Runat,server, and change yhname text box to server control, as shown in Figure 6-1-4:

Figure 6-1-4 Modifying text box labels

(3) and so on, the corresponding text box named Yhpass, password again confirm the corresponding text box named REPASS,QQ code corresponding to the text box named yhqq,email the corresponding text box named Yhemail, the home page corresponding text box named Yhindex, Change all text boxes to server controls.

(4) Select the form yhinfrm and change it to a server control, saving the yhinlog.aspx.

  6.1.3 Complete the registration page design

  (1) Create a new Dynamic Web page yhlogok.aspx by template bkblog.dwt.aspx, insert three rows of table in mainbody editable region Logok, enter text "Welcome" in the second line, click "Bind data" on the ASP.net shortcut menu, Click on "trimmed form elements", move the cursor to the position shown in Figure 6-1-5, and enter "Yhname".

Figure 6-1-5 Insert a trimmed form element

(2) Return to Design view, continue entering text "Donking ' s blog! ", and, for the table Logok, for the design, the results are as shown in Figure 6-1-6:

Figure 6-1-6 design of table Logok

(3) Select the button "Home" button, in the "Behavior" panel, add behavior to the URL, in the pop-up dialog box, enter the link to "index.aspx", Save yhlogok.aspx

6.2 Authentication User Registration

In order to prevent users from entering the wrong registration information, the user registration information should be standardized and validated.

(1) Open yhinlog.aspx, open asp.net shortcut menu, click "More Tags", as shown in Figure 6-2-1:

Figure 6-2-1 asp.net shortcut menu

(2) in the pop-up tag selector to expand the "asp.net tag" → "validation server Control", in the right window rack select "Asp:requiredfieldvalidator", click the "Insert" button, as shown in Figure 6-2-2:

Figure 6-2-2 Tag Selector

(3) in the pop-up tag editor, add a validation control for the text box yhname, and fill in the items as shown in Figure 6-2-3:

Figure 6-2-3 RequiredFieldValidator Tag Editor

(4) Open the tag selector, insert the asp.net validation server control →comparevalidator control, add a contrast validation control for the text box yhpass with the Repass text box, and fill in the information as shown in Figure 6-2-4:

Figure 6-2-4 Comparevalidato Tag Editor

(5) Insert the ASP.net validation server control →rangevalidator control, add a validation control for the text box yhqq, and fill in the information as shown in Figure 6-2-5:

Figure 6-2-5 Range Validator Label Editor

(6) Insert the ASP.net validation server control →regularexpressionvalidator control, add a validation control for the text box Yhemail, and fill in the items as shown in Figure 6-2-6, where the validation expression is: \w+ ([-+.] \w+) *@\w+ ([-.] \w+) *\.\w+ ([-.] \w+) *

Figure 6-2-6 Regular Expression Validator Tag Editor

(7) Insert the ASP.net validation server control →regularexpressionvalidator control, add a validation control for the text box Yhindex, and fill in the items as shown in Figure 6-2-7, where the validation expression is: http://([\w-]+\.) +[\w-]+ (/[\w-/?%&=]*)?

Figure 6-2-7 Regular Expression Validator Tag Editor

(8) Another validation control should prevent duplicate user names registered by the user.

① Add DataSet Yhinlog, set to filter, filter field yhname, parameter variable to form variable Yhname, and its settings as shown in Figure 6-2-8:

Figure 6-2-8 Insert DataSet Yhinlog

② Insert the asp.net validation server control →customvalidator control, add validation controls for the text box Yhindex, and fill in the items as shown in Figure 6-2-9, where the client-side validation features are:

<%# IIf (Yhinlog. Recordcount>0,false,true)%>

Figure 6-2-9 Custom Validator Tag Editor

(9) Save yhinlog.aspx, browse in IE, if the dialog box shown in Figure 6-2-10 shows, the Dklog site root directory does not have subdirectory aspnet_client, there is no validation control necessary JS script library. This is installed. NET Framework, the installer has been replicated at the default site C:\ Inetpub\Wwwroot the root directory, copy the C:\ Inetpub\Wwwroot subdirectory aspnet_client to the Dkblog site root directory, OK!

Figure 6-2-10 cannot find the necessary JS script Library

6.3 Adding "Insert Record" server behavior

(1) Open yhinlog.aspx, add the Insert record server behavior, and the form's data is added to the datasheet yh, and the settings are as shown in Figure 6-3-1:

Figure 6-3-1 Adding the Insert record server behavior

(2) ASP.net is not supported gb2312 encoded transmission. Switch to Code view to find:

<%@ Page language= "VB" contenttype= "text/html" responseencoding= "gb2312"%>

The responseencoding= "gb2312" This code to delete the line OK:

<%@ Page language= "VB" contenttype= "text/html"%>

(3) Save, browse in IE to submit user registration information, open YH table in Access, you can find that the submitted Chinese information has become a??。 Then what? Don't worry, this is because Tasp.net does not support gb2312 encoded transmissions. Open yhinlog.aspx, switch to Code view, and find the first line of code:

<%@ Page language= "VB" contenttype= "text/html" responseencoding= "gb2312"%>

Change it to:

<%@ Page language= "VB" contenttype= "text/html"%>

Which is to remove responseencoding= "gb2312". Other Web pages are also modified to prevent errors in the submission of information in Chinese.

  

Turn from: Dynamic Network production guide www.knowsky.com

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.