usingSystem;usingSystem.Collections.Generic;usingSystem.Linq;usingSystem.Text.RegularExpressions;usingsystem.web;usingSystem.Web.UI;usingSystem.Web.UI.WebControls; Public Partial classzhuce:system.web.ui.page{protected voidPage_Load (Objectsender, EventArgs e) { if(! IsPostBack)//determine if a postback is in response{Insert ("0001"); } } //linkage protected voidDropdownlistsheng_selectedindexchanged (Objectsender, EventArgs e) { stringCode =DropDownListSheng.SelectedItem.Value; List<ChinaStates> Listshi =NewCHINASTATESDA (). Selectbyparentareacode (Code); Dropdownlistshi.datasource=Listshi; Dropdownlistshi.datatextfield="AreaName"; Dropdownlistshi.datavaluefield="AreaCode"; Dropdownlistshi.databind (); Updatepanel1.update (); } //the area of the initial load page is displayed Public voidInsert (stringParentcode) {List<ChinaStates> Listsheng =NewCHINASTATESDA (). Selectbyparentareacode (Parentcode); Dropdownlistsheng.datasource=Listsheng; Dropdownlistsheng.datatextfield="AreaName"; Dropdownlistsheng.datavaluefield="AreaCode"; Dropdownlistsheng.databind (); List<ChinaStates> Listshi =NewCHINASTATESDA (). Selectbyparentareacode (" One"); Dropdownlistshi.datasource=Listshi; Dropdownlistshi.datatextfield="AreaName"; Dropdownlistshi.datavaluefield="AreaCode"; Dropdownlistshi.databind (); List<ChinaStates> Listdiqu =NewCHINASTATESDA (). Selectbyparentareacode ("1101"); Dropdownlistddiqu.datasource=Listdiqu; Dropdownlistddiqu.datatextfield="AreaName"; Dropdownlistddiqu.datavaluefield="AreaCode"; Dropdownlistddiqu.databind (); } //Regional Linkage protected voidDropdownlistshi_selectedindexchanged (Objectsender, EventArgs e) { stringCode =DropDownListShi.SelectedItem.Value; List<ChinaStates> Listdiqu =NewCHINASTATESDA (). Selectbyparentareacode (Code); Dropdownlistddiqu.datasource=Listdiqu; Dropdownlistddiqu.datatextfield="AreaName"; Dropdownlistddiqu.datavaluefield="AreaCode"; Dropdownlistddiqu.databind (); Updatepanel1.update (); } //trigger when user name text changes protected voidTxtuser_textchanged (Objectsender, EventArgs e) { if(Txtuser. text.length<4) {Labeluser.text="User name length cannot be less than 4"; } Else { BOOLisOK =NewUSERSDA (). Checkusersname (Txtuser. Text); if(isOK) {Labeluser.text="√"; } Else{Labeluser.text="X"; } } } //trigger when name text changes protected voidTxtname_textchanged (Objectsender, EventArgs e) { if(txtname. text.length<4) {labelName.Text="User name length cannot be less than 4"; } Else{labelName.Text="√"; } } //trigger when password text changes protected voidTxtpwd_textchanged (Objectsender, EventArgs e) { if(Txtpwd. text.length<6) {Labelpwd.text="password length cannot be less than 6 bits"; } Else{Labelpwd.text="√"; } } //Determine if the password is consistent protected voidTxtpwd2_textchanged (Objectsender, EventArgs e) { if(TXTPWD2. text==txtpwd. Text) {Labelpwd2.text="√"; } Else{Labelpwd2.text="two times password inconsistency"; } } //Register button protected voidButton1_Click (Objectsender, EventArgs e) { Try{Users P=NewUsers (); P.usersname=Txtuser. Text; P.name=txtname. Text; P.pwd=txtpwd. Text; P.account=Txtpwd2. Text; P.sex= Radiobutton1.checked = =true?"male":"female"; P.home= DropDownListSheng.SelectedItem.Text + DropDownListShi.SelectedItem.Text +DropDownListDdiqu.SelectedItem.Text; P.brithday=DateTime.Parse (Txtbir. Text); P.tel=Txttel. Text; P.QQ=txtqq. Text; P.email=Txtemail. Text; NewUSERSDA (). Insert (P); varRe =Base. Response; Re. Redirect ("loginss.aspx"); } Catch(Exception) {Response.Write ("<script>alert (' Wrong fill in information ') </script>"); } finally { varRe =Base. Response; Re. Redirect ("zhuce.aspx"); } } //determine mailbox input format protected voidTxtemail_textchanged (Objectsender, EventArgs e) {MatchCollection MC= Regex.Matches (txtemail. Text.tostring (). Trim (),@"[a-za-z0-9_\-\.] [Email protected]\w+ (\.\w+) +"); if(mc!=NULL) { } Else{Labelemail.text="The mailbox format is not correct"; } }}
WebForm Registration Interface